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
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:
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 devand go to http://localhost:3000/44 in browser.idparameter is actually a string while shows as number typeExpected 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