React Query is now written in TypeScript to make sure the library and your projects are type-safe!
Things to keep in mind:
When defining a custom hook you need to specify the result and error types, for example:
function useGroups() {return useQuery<Group[], Error>('groups', fetchGroups)}
For tips and tricks around type inference, have a look at React Query and TypeScript from the Community Resources.
The best JavaScript newsletter! Delivered every Monday to over 76,000 devs.