Relative Content

Tag Archive for typescriptreact-querytanstackreact-query

Infer TError useQuery based on the queryFn return type

I am fetching some data in React with useQuery from tanstack. This hook returns UseQueryResult<TData, TError> and tanstack nicely infers TData from the queryFn making the fetch, but I can’t make Typescript infer TError from the same function.