question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to override react-query Error generic?

See original GitHub issue

What are the steps to reproduce this issue?

  1. Use my openapi.yaml
  2. On a react-query client with a custom instance using axios (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:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
anymaniaxcommented, Nov 28, 2021

Should be fixed with 6.4.0 can you test when you have time, please?

1reaction
anymaniaxcommented, Nov 22, 2021

Hi @OliverDudgeon, interesting idea I need to check a bit more how I can add something like that

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found