TanStackT
TanStack6mo ago
14 replies
dry-scarlet

usequery error typing

Hello everyone,

When I use a queryKey created with queryOptions in useQuery, the data type is automatically inferred from the return value of queryFn.

However, the error type is inferred as Error.
Is there a reason for this?

Other than using generics in useQuery to define the error type or using declare, are there any other options?
Was this page helpful?