Incorrect type on `routeTree.children`
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 15.1k
- Forks
- 1.9k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 143
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked StackBlitz reproduction and its src/routes/about.tsx entry point, then trace how routeTree.children is typed and populated at runtime. Confirm that the declared type matches the observed array so callers can loop over root routes and generate navigation without a type mismatch.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100