router-plugin versions 1.150.0 and later generate routeTree.gen.ts with type declaration errors
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
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
- 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
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
Open the linked StackBlitz reproducer and compare routeTree.gen.ts generated with @tanstack/router-plugin 1.150.0 versus 1.151.0 or later. Start with the generated declarations used by router.routesByPath['/test'], then run the TypeScript check to identify the reported error. Done means the generated route tree has compatible declarations and the reproducer passes the TypeScript check on newer plugin versions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100