New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Didn't take Generics in isAxiosError()
for AxiosError<any>
#3815
Comments
Any updates on this? |
latipun7
changed the title
Didn't take Generics in Oct 1, 2021
isAxiosError()
didn't take Generics for AxiosError<any>
isAxiosError()
for AxiosError<any>
Quick fix until #3816 is merged is to create the following file // axios.d.ts
declare module "axios" {
interface AxiosStatic {
isAxiosError<T = any>(payload: any): payload is AxiosError<T>;
}
}
export {}; |
Clear PR #4344
|
Workaround for 0.x version:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the issue
axios.isAxiosError
is type predicatedisAxiosError(payload: any): payload is AxiosError;
innode_modules/axios/index.d.ts
whileAxiosError
take generics default toany
.How can I make
isAxiosError
is predicated topayload is AxiosError<Response>
?Example Code
Code snippet to illustrate your question
Expected behavior, if applicable
I can type
AxiosError
withAxiosError<Response>
generics withisAxiosError
accept generics.Environment
Additional context/Screenshots
The text was updated successfully, but these errors were encountered: