Path parameters for server routes are not parsed correctly and have invalid typescript types
@Sheraff is already working on this.
Since Sep 15, 2026.
- 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
Path parameters for server routes are not parsed correctly and have invalid typescript types.
https://github.com/valerii15298/tss-repros/blob/server-route-path-params-parsing/src/routes/%24id.tsx
Reproduction code:
import { createFileRoute } from "@tanstack/react-router";
export const Route = createFileRoute("/$id")({
params: {
parse: (p) => ({ id: Number(p.id) }),
stringify: (p) => ({ id: String(p.id) }),
},
server: {
handlers: {
GET({ params }) {
// params type: { id: number; } but in runtime actually { id: string; }
console.log(typeof params.id)
return Response.json(params);
},
},
},
});
Complete minimal reproducer
https://github.com/valerii15298/tss-repros/tree/server-route-path-params-parsing
Steps to Reproduce the Bug
Go to the reproduction repo branch, run pnpm dev and go to http://localhost:3000/44 in browser.
id parameter is actually a string while shows as number type
Expected behavior
Path parameters should be parsed for server routes too or the types should be correct.
Screenshots or Videos
No response
Platform
@tanstack/react-router@1.170.36
@tanstack/react-start@1.168.53
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.
Assessment
This issue has not been assessed yet.