TanStackT
TanStack2y ago
1 reply
uncertain-scarlet

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;


error: /fileName.tsx(45,35): error TS2339: Property 'someId' does not exist on type '{}'.
Was this page helpful?