Which project does this relate to?#
Router
Describe the bug#
routeTree.children has the type RootRouteChildren | undefined
If you type routeTree.children. You get the route key names as options
However in the browser, if you console.log(routeTree.children) you get an array:
I want to be able to generate a navigation by looping over all of the root routs. This gets in the way of that.
Your Example Website or App#
https://stackblitz.com/edit/github-bii6hl4v?file=src%2Froutes%2Fabout.tsx
Steps to Reproduce the Bug or Issue#
Set up some routes and then try to access the data from routeTree.children
Expected behavior#
The actual type for routeTree.children should match the type that TS says it is.
Screenshots or Videos#
No response
Platform#
- Router / Start Version: 1.121.2
- OS: Windows 11
- Bundler: vite 6.1.0
Additional context#
No response
Confirmed this is still present on current main. Generated route children use a keyed object for type inference, but
_addFileChildrenstoresObject.values(children)at runtime. This leavesrouteTree.childrentyped as an object even though its runtime value is an array.The object representation was introduced for TypeScript performance in #1564, so a fix will need to preserve that type-level structure while correctly typing the runtime
childrenproperty.Keeping this open as a types bug.