Override default error generic type typescript-react-query #5377
-
Hi, currently this is the typescript being generated: export const useMostRecentUsersQuery = <
TData = MostRecentUsersQuery,
TError = unknown
>(
variables: MostRecentUsersQueryVariables,
options?: UseQueryOptions<MostRecentUsersQuery, TError, TData>
) =>
useQuery<MostRecentUsersQuery, TError, TData>(
['MostRecentUsers', variables],
fetcher<MostRecentUsersQuery, MostRecentUsersQueryVariables>(MostRecentUsersDocument, variables),
options
); However, I know that all of my errors will be of a custom type we have so it would be nice if instead of generating |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
GraphQL spec doesn't have any way to define types of errors, and usually it's done based on project needs. We can't really expect specific errors, or even error types, so all we can do here is to allow you to override it as a generic. I added an option to override the default error type, if that helps: #5447 . I will be available in the next release ( |
Beta Was this translation helpful? Give feedback.
GraphQL spec doesn't have any way to define types of errors, and usually it's done based on project needs. We can't really expect specific errors, or even error types, so all we can do here is to allow you to override it as a generic.
I added an option to override the default error type, if that helps: #5447 . I will be available in the next release (
1.1.0
, and already available in alpha:@graphql-codegen/[email protected]
)