UseQuery return type set to any after typescript-eslint update
Hi !
I have a simple useQuery hook that receive for queryFn a typed function, after updating typescript-eslint the return value of the hook is now set to any.
Is there a solution for this ? 😢
8 Replies
flat-fuchsia•8mo ago
Use skipToken?
https://tanstack.com/query/latest/docs/framework/react/guides/disabling-queries/#typesafe-disabling-of-queries-using-skiptoken
Disabling/Pausing Queries | TanStack Query React Docs
If you ever want to disable a query from automatically running, you can use the enabled = false option. The enabled option also accepts a callback that returns a boolean. When enabled is false: If the...
flat-fuchsiaOP•8mo ago
I don't think that's the issue.
I've tried removing 'enabled' parameter but I still get the response as any, it doesnt seem to be a condition issue
I think it was typed properly before I updated typescript-eslint to latest
foreign-sapphire•8mo ago
please show a typescript playground
flat-fuchsiaOP•8mo ago
Uh I tried on a codesandbox and it worked properly, seems like I just had to restart vscode
Thanks for the help
flat-fuchsiaOP•8mo ago
flat-fuchsia•8mo ago

wise-white•8mo ago
Most of the weird issue with eslint showing funny type all over the place after upgrading, just need a restart of vs-code
exotic-emerald•8mo ago
Ctrl+Shift+P and restarting the eslint server most often works too (and is a little quicker than a full restart)
I find myself using this a few times a day
