Type for global error in QueryCache & MutationCache
I have a little issue. I want to define my own types for global onError callback in queryCache & mutationCache. I need error to be type of AxiosError. I can't find a working solution. I'd be glad if someone helped me. Thanks!
2 Replies
extended-salmon•2y ago
It's quite well documented: https://tanstack.com/query/v5/docs/framework/react/typescript#typing-the-error-field
https://tanstack.com/query/v5/docs/framework/react/typescript#registering-a-global-error
TypeScript | TanStack Query Docs
React Query is now written in TypeScript to make sure the library and your projects are type-safe!
Things to keep in mind:
ambitious-aquaOP•2y ago
Thanks, I've tried it but forgot 💀