#UseQuery return type set to any after typescript-eslint update

10 messages · Page 1 of 1 (latest)

orchid forum
#

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 ? 😢

const {
       isError, // THIS IS NOW ANY 
       isLoading, // THIS IS NOW ANY 
       isFetching, // THIS IS NOW ANY 
       refetch: refetchTasks, // THIS IS NOW ANY
       data: tasks, // THIS IS NOW ANY :'(
       error,
   } = useQuery({
       queryKey: [`tasks`, session?.user?.id],
       queryFn: () => fetchTasks(session?.user?.id), // fetchTasks return Promise<Task[]>
       enabled: !!session?.user?.id,
       
   })
marsh gate
orchid forum
#

I think it was typed properly before I updated typescript-eslint to latest

gloomy pawn
#

please show a typescript playground

orchid forum
#

Uh I tried on a codesandbox and it worked properly, seems like I just had to restart vscode

#

Thanks for the help

marsh gate
fast wadi
#

Most of the weird issue with eslint showing funny type all over the place after upgrading, just need a restart of vs-code