definetly type "handle" in a Route component (typescript) #10180
Replies: 4 comments 6 replies
-
|
I'm trying to do the same thing (make sure I don't have a typo in my
|
Beta Was this translation helpful? Give feedback.
-
|
I'm still working on a similar thing and it seems as though UIMatch<Data = unknown, Handle = unknown>Although not ideal, a starting point might be something like: const getHandleTitle = (matches: UIMatch<unknown, { title: string }>[]) => {
const title = matches[matches.length - 1].handle.title
} |
Beta Was this translation helpful? Give feedback.
-
|
Since there doesn't seem to be a built-in way to extend the existing type I'm working around this by wrapping the note: I used This also allows you to type the |
Beta Was this translation helpful? Give feedback.
-
|
This needs to be solved properly with the generated types. |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
I'm creating a breadcrumb using the useMatches hook, similar to the example in the documentation and I have 2 different kinds of crumbs that i'm using in my app. i'm looking for a way to change the typing of the "handle" props to extend my own crumb type on it.
type NamedCrumb = { name: string };type DynamicCrumb = { parameterName: string };type CrumbType = NamedCrumb | DynamicCrumb;I'd want the handle props to specify the presence of an optional crumb parameter typed CrumbType
Beta Was this translation helpful? Give feedback.
All reactions