useParams returns any
Hi everyone,
TypeScript:
Unsafe assignment of an 'any' value
Do you know why this is happening? I tried tweaking the configuration, read through the useParams docs, and got nothing. Additionally, I remember that in other projects the returned parameter was of type string. What could be going on?2 Replies
robust-apricot•6mo ago
make sure to register the router type as shown in the docs
also do you have strict null check activated in tsconfig.json ?
if all this does not help, please provide a minimal complete example
optimistic-goldOP•6mo ago
Thanks, I didn't register the router type.
https://tanstack.com/router/v1/docs/framework/react/api/router/RegisterType
Solved
Register type | TanStack Router React Docs
This type is used to register a route tree with a router instance. Doing so unlocks the full type safety of TanStack Router, including top-level exports from the @tanstack/react-router package. tsx ex...