type error when passing number to `Link.params`
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
despite the docs: https://github.com/TanStack/router/blob/410fdf808d959de0efb92a9d1339048a7cd053f1/docs/router/framework/react/guide/path-params.md?plain=1#L409-L414
putting numbers in params on Link component gives type error
Your Example Website or App
https://stackblitz.com/edit/github-ynvn4fan?file=src%2Froutes%2F__root.tsx
Steps to Reproduce the Bug or Issue
- create any route with params e.g
$foo.bar.tsx <Link to="/$foo/bar" params={{ foo: 3 }}>- get type error that you cannot assign number to string
Expected behavior
type works like the docs
the numbers do get auto-stringified, but the type error makes everything cumbersome (have to wrap in String)
Screenshots or Videos
Platform
- Router / Start Version: 1.133.20
- OS: macOS
- Browser: Firefox
- Browser Version: 145.0b3
- Bundler: vite
- Bundler Version: 7.1.7
Additional context
for some reason this error isn't reproducible on tanstack/router repo.
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 the React path-params documentation at the referenced lines, using a route such as $foo.bar.tsx and Link with params={{ foo: 3 }}. Compare its generated types with the TanStack Router repository, where the issue says the problem is not reproducible; done means numeric Link.params values type-check while retaining the documented auto-stringification behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100