You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When your error has some value like error.response which come from your server you always type like this for better error typing:
// There will be bunch of imports for type...usePaginatedQuery<AxiosResponse<PagingResponseType<ExampleResponseValue>>,[string,QueryType],CustomErrorResponse>(['example',query],getExampleApi)
or
// const{error: any}=usePaginatedQuery<...>([...],exampleApi,{onError(err: any){}// Note: err's original type is Error})
It would be better if we can define error type only once using ReactQueryProviderConfig<TError>
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
When your error has some value like
error.response
which come from your server you always type like this for better error typing:or
It would be better if we can define error type only once using
ReactQueryProviderConfig<TError>
Any better thoughts?
Beta Was this translation helpful? Give feedback.
All reactions