Skip to content

Incorrect type on routeTree.childrenΒ #4766

@Dan503

Description

@Dan503

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

Image

However in the browser, if you console.log(routeTree.children) you get an array:

Image

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions