Replies: 1 comment
-
You could achieve this by getting the import type { FileRouteTypes } from "@/routeTree.gen";
function Comp<TFrom extends Extract<FileRouteTypes["fullPaths"], "/posts/$postId" | "/users/$userId">>({
from,
}: {
from: TFrom;
}) {
const params = useParams({ from });
// ^? { postId: string } | { userId: string }
} |
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.
-
I'd like to access the param of multiple routes typesafely in a shared component
Something like:
Is there any way to do something like that without having to use
strict: false
?Beta Was this translation helpful? Give feedback.
All reactions