Path parameters for server routes are not parsed correctly and have invalid typescript types
Author: valerii15298Created Sep 15, 2026Updated Sep 15, 2026
Labelsbug
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/[email protected] @tanstack/[email protected]
Additional context
No response
Source: TanStack/router