Replies: 4 comments 3 replies
-
I have the same question, did you figure this out? |
Beta Was this translation helpful? Give feedback.
0 replies
-
Trying to understand the same, very unclear... |
Beta Was this translation helpful? Give feedback.
0 replies
-
try this as a type, works for import type { RegisteredRouter, RouteIds, RoutePaths } from '@tanstack/react-router';
export type RoutePath = RoutePaths<RegisteredRouter['routeTree']>;
export type RouteId = RouteIds<RegisteredRouter['routeTree']>; |
Beta Was this translation helpful? Give feedback.
3 replies
-
Your So maybe this works ?
declare module "@tanstack/react-router" {
interface Register {
router: ReturnType<typeof createRouter>;
}
interface StaticDataRouteOption {
i18nKeyTitle?: string;
backTo?: keyof FileRoutesByPath;
}
} You could also use |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a use-case where a global component shows a "go back" link.
I'd like to configure the target of this go back link per Route.
Instead of moving the component from a global layout down to each Route, I'd like to use the
staticData
prop on each Route.To ensure type-safety, I'd like to somehow - on the type level, function level, or even component level - ensure my pathname is part of my routeTree.
I already tried typing inside
StaticDataRouteOption
, but I'm blocked due to circular references :I was also thinking about a hook which would validate a pathname as being part of my routeTree :
What do you think ?
Beta Was this translation helpful? Give feedback.
All reactions