T
TanStack13mo ago
evident-indigo

useParams typescript error

I have some shared components that i use across different routers. I wanna use useParams hook but sometimes params is not on URL and passed to component like a param. In this cases i got TS error: example:
const someId =
useParams({ strict: false })?.someId || props.someId;
const someId =
useParams({ strict: false })?.someId || props.someId;
error: /fileName.tsx(45,35): error TS2339: Property 'someId' does not exist on type '{}'.
1 Reply
compatible-crimson
compatible-crimson13mo ago
can you please provide a minimal complete example by forking one of the existing examples on stackblitz?

Did you find this page helpful?