Code-based, path types lost when router tree scales #1344
Replies: 2 comments 1 reply
-
Note that: I also tried to separate all routes to their own file and only use default export. Its still same. |
Beta Was this translation helpful? Give feedback.
-
Im getting to conclusion of that, if you start routeTree with more than 2 level of nested Pathless Routes it breaks the types at some point. Like:
Types seems to be working. Is this is a bug ? Or some typescript limit thing when inferring this much? or probably both ? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I'm trying to implement code-based tanstack router to a medium/big scale project. It should be code-based for various reasons.
I realized that if routeTree is big enough all union types of the paths are transforming to any so ts autocomplete is gone.
Do i missing something ?
React version: 18.2.0
Typescript version: 5.3.2
Tanstack router version : 1.20.1
When my routeTree is like below, typings works correctly
Type completion works as shown below:

But if i try to add one more route as a child of adminSettingsRoute, path type becomes any;
So, my router.ts :
My file that includes root router setup;
Also at the same time I started to get
Type instantiation is excessively deep and possibly infinite
Error in various places like useMatches() or getRouteApi()
Thanks for help!
Beta Was this translation helpful? Give feedback.
All reactions