icd2k3/react-router-breadcrumbs-hoc

TypeScript: `matchOptions` missing from `BreadcrumbsRoute`

Closed this issue ยท 4 comments

Hi!

Thanks for your work on this HoC and for including TS-support!

I notice the docs and code open for giving matchOptions to each breadcrumb route. However, matchOptions is missing from the type definitions, so if I try to assign the correct type to the options given to withBreadcrumbs I get a type error.

Example:

const breadcrumbs: BreadcrumbsRoute[] = [
  {
    path: '/path/',
    breadcrumb: 'New',
    matchOptions: {
      exact: true,
    },
  },
  {
    path: '/path/:id?',
    breadcrumb: 'Edit',
  },
];

The type checker complains that matchOptions is not defined. A workaround is to remove the BreadcrumbsRoute[] typing, but it would be nice to avoid that.

I can open up a PR that adds the missing definitions if you'd like.

Thanks for reporting this @wkillerud!

I should be able to make & publish this change in the next day or 2 (if you beat me to it I'll be happy to merge a PR, though!).

@wkillerud this PR should fix the issue I think #43. Mind giving it a look? I can merge/deploy it in the near future if it looks good.

This change is now published as 2.1.5 - let me know if you still have issues with TS! (side note: looks like I have some dependency upgrades to do on the typescript end... another day ๐Ÿ˜„ )

Works like a charm, thank you! ๐ŸŽ‰