How to override react-query Error generic?
See original GitHub issueWhat are the steps to reproduce this issue?
- Use my openapi.yaml
- On a
react-query
client with a custom instance usingaxios
(e.g. the one used in the docs).
What happens?
The generated hooks have these generic types <TData = AsyncReturnType<typeof downloadDataset>, TError = Error>
where Error
is the interface generated by Orval.
However since we’re using Axios the Error type is actually AxiosError<Error>
. Is there currently anyway to override this?
What versions are you using?
Operating System: Ubuntu 20.04 Package Version: 6.3.0
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:9 (9 by maintainers)
Top Results From Across the Web
React Query Error Handling | TkDodo's blog
Here, we're handling error situations by checking for the isError boolean flag (which is derived from the status enum) given to us by...
Read more >TypeScript: How to type react-query useMutation onError with ...
You've already declared a hook with a generic error field, if you don't provide the param, it defaults to a ... So make...
Read more >[v5] react-query hooks ignore the `Data` generic passed to them
The react-query hooks accept two generics. one for the Data and another one for the Error. Which are supposed to give the user...
Read more >Query Functions | TanStack Query Docs
For React Query to determine a query has errored, the query function must throw or return a rejected Promise. Any error that is...
Read more >React Query and TypeScript - DEV Community
Over time, React Query has added more Generics to the useQuery hook (there are ... TError : the type of Errors to expect...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Should be fixed with
6.4.0
can you test when you have time, please?Hi @OliverDudgeon, interesting idea I need to check a bit more how I can add something like that