createRoute context argument still any despite AnyRouteWithContext<TestContext>
I'm trying to make sure my route has proper context typing instead of any. I have lots of routes and I'd like context to be available.
I have this setup:
I am using code based routing.
I expected that passing
AnyRouteWithContext<TestContext> for Parent would make the context argument properly typed, but TypeScript still shows it as any. My best guess is that it's because it's not directly importing the route.
What’s the correct way to ensure the context type flows through here instead of defaulting to any?
My end goal was to have something like this
Should I be taking an alternate approach?
Cheers!2 Replies
conscious-sapphire•2mo ago
this is not how code based routing works with typesafety in tanstack router
conscious-sapphire•2mo ago
Code-Based Routing | TanStack Router React Docs
[!TIP] Code-based routing is not recommended for most applications. It is recommended to use instead. ⚠️ Before You Start If you're using , skip this guide. If you still insist on using code-based rou...