Skip to content

router-plugin versions 1.150.0 and later generate routeTree.gen.ts with type declaration errors #7458

@faner11

Description

@faner11

Which project does this relate to?

Router

Describe the bug

The routeTree.gen.ts generated in versions after @tanstack/router-plugin 1.150.0 is inconsistent with version 1.150.0. I created a test path, and the following code was normal in version 1.150.0, passed the TypeScript check, but in subsequent versions, this code still works normally, but the TypeScript check reports an error.

  const router = useRouter();
  React.useEffect(() => {
    console.log(router.routesByPath['/test']);
  }, [router]);

Complete minimal reproducer

https://stackblitz.com/edit/github-shjftka4?file=src%2Froutes%2F__root.tsx

Steps to Reproduce the Bug

  1. Change "@tanstack/router-plugin": "1.150.0" in package.json to 1.151.0 or any other new version

Expected behavior

Screenshots or Videos

No response

Platform

  • Router Version: [e.g. 1.151.0 ]
  • OS: [e.g. macOS]
  • Browser: [e.g. Chrome]
  • Browser Version: [e.g. 91.1]
  • Bundler: [e.g. vite]
  • Bundler Version: [e.g. 7.0.0]

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions