#Bunch of Route functions are returning an any type
8 messages · Page 1 of 1 (latest)
Could you create a minimal repro demonstrating this issue? you can start from one of the stackblitz examples like this one https://tanstack.com/router/latest/docs/framework/react/examples/basic-file-based
An example showing how to implement Basic File Based in React using TanStack Router.
My problem was fixed. I was missing a / at the end of the route.
A second thing came up though. I had a problem earlier with Route.useSearch and Route.useParams always having an any type which is also visible in the exact stackblitz example without changing anything.
Also things like router.history from useRouter also have an any type.
Bunch of Route functions are returning an any type
do you have the type augmentation set up? (https://tanstack.com/router/latest/docs/guide/type-safety#exported-hooks-components-and-utilities)
declare module '@tanstack/react-router' {
interface Register {
router: typeof router
}
}
also stackblitz is sometimes weird with TS when using generated types. Do you actually have the issue locally on your machine?
TanStack Router is built to be as type-safe as possible within the limits of the TypeScript compiler and runtime. This means that it's not only written in TypeScript, but that it also fully infers the...
I guess I was dumb enough to not read that part. It all works now. Thanks ;D