TS error "unsafe assignment of type any" using `Route.useParams()`
In this case, it seems like my $lang and $id params should be typed automatically (I have registered the router, per these instructions), but I'm still getting this error: "Unsafe assignment of an
any
value." Any advice?
(Copilot says to change the useParams call to Route.useParams<{ lang: string; id: string }>()
which actually does fix some of the downstream TS errors, but creates its own TS error and also just seems wrong.)
4 Replies
flat-fuchsia•6mo ago
can you please provide a complete minimal example?
deep-jadeOP•6mo ago
hey @Manuel Schiller , while I was doing this I discovered that the eslint rules for
tseslint.plugin.configs['recommended-requiring-type-checking'].rules,
were the source of the problem. Now that I've removed this the params correctly destructure with string
types inferred as expected. False alarm / thanks.flat-fuchsia•6mo ago
great!
deep-jadeOP•6mo ago
the same issue was showing up for useSearch (and fixed by removing)