-
Notifications
You must be signed in to change notification settings - Fork 169
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
Argument of type 'AxiosInstance' is not assignable to parameter of type 'AxiosStatic | AxiosInstance' #159
Comments
same here. Platform: macOS Cataline v10.15.7 |
I had that problem too - in my case it was old version of axios that caused this error (I had I also have yarn workspaces set up and axios was listed in one of workspace's "resolutions": {
"axios": "0.21.1"
} |
Hello, same error here, any updates? Node.JS 16.13.1 |
Was this ever solved? @rubennorte |
+1 |
1 similar comment
+1 |
I had same error with:
Added:
which fixed it. |
same here, but resolutions didn't fix. Although the issue is just on Heroku. Locally there are no problems. I've checked the versions. |
This is still an issue, please fix it |
Sorry if I am wrong. I hope this is of some help to you. It may be due to a different version of axios. Since import axiosRetry, { exponentialDelay } from 'axios-retry'; // <- version of axios on which the type definition depends is 1.2.3
import axios from 'axios'; // <- this axios is 1.4.0
axiosRetry(axios, { retryDelay: exponentialDelay }); // compile error My full error logs is below. $ npx tsc
index.ts:4:12 - error TS2345: Argument of type 'AxiosStatic' is not assignable to parameter of type 'AxiosInstance | AxiosStatic'.
Type 'AxiosStatic' is not assignable to type 'AxiosInstance'.
Types of property 'defaults' are incompatible.
Type 'Omit<import("/home/study/workspace/axios-retry/spec/typings/cjs/node_modules/axios/index").AxiosDefaults<any>, "headers"> & { headers: import("/home/study/workspace/axios-retry/spec/typings/cjs/node_modules/axios/index").HeadersDefaults & { ...; }; }' is not assignable to type 'Omit<import("/home/study/workspace/axios-retry/node_modules/axios/index").AxiosDefaults<any>, "headers"> & { headers: import("/home/study/workspace/axios-retry/node_modules/axios/index").HeadersDefaults & { ...; }; }'.
Type 'Omit<AxiosDefaults<any>, "headers"> & { headers: HeadersDefaults & { [key: string]: AxiosHeaderValue; }; }' is not assignable to type 'Omit<AxiosDefaults<any>, "headers">'.
Types of property 'transformRequest' are incompatible.
Type 'import("/home/study/workspace/axios-retry/spec/typings/cjs/node_modules/axios/index").AxiosRequestTransformer | import("/home/study/workspace/axios-retry/spec/typings/cjs/node_modules/axios/index").AxiosRequestTransformer[]' is not assignable to type 'import("/home/study/workspace/axios-retry/node_modules/axios/index").AxiosRequestTransformer | import("/home/study/workspace/axios-retry/node_modules/axios/index").AxiosRequestTransformer[]'.
Type 'AxiosRequestTransformer' is not assignable to type 'AxiosRequestTransformer | AxiosRequestTransformer[]'.
Type 'import("/home/study/workspace/axios-retry/spec/typings/cjs/node_modules/axios/index").AxiosRequestTransformer' is not assignable to type 'import("/home/study/workspace/axios-retry/node_modules/axios/index").AxiosRequestTransformer'.
The 'this' types of each signature are incompatible.
Type 'AxiosRequestConfig<any>' is not assignable to type 'InternalAxiosRequestConfig<any>'.
Types of property 'headers' are incompatible.
Type 'import("/home/study/workspace/axios-retry/node_modules/axios/index").AxiosRequestHeaders' is not assignable to type 'import("/home/study/workspace/axios-retry/spec/typings/cjs/node_modules/axios/index").AxiosRequestHeaders'.
Type 'AxiosRequestHeaders' is not assignable to type 'Partial<RawAxiosHeaders & { Accept: AxiosHeaderValue; "Content-Length": AxiosHeaderValue; "User-Agent": AxiosHeaderValue; "Content-Encoding": AxiosHeaderValue; Authorization: AxiosHeaderValue; } & { ...; }>'.
'string' index signatures are incompatible.
Type 'AxiosHeaderValue' is not assignable to type 'import("/home/study/workspace/axios-retry/spec/typings/cjs/node_modules/axios/index").AxiosHeaderValue'.
Type 'AxiosHeaders' is not assignable to type 'AxiosHeaderValue'.
Type 'AxiosHeaders' is missing the following properties from type 'AxiosHeaders': setAuthorization, getAuthorization, hasAuthorization, [Symbol.iterator]
4 axiosRetry(axios, { retryDelay: exponentialDelay });
~~~~~
Found 1 error in index.ts:4 |
Started getting this after updating from Axios 1.5 to 1.6. Probably related to https://github.com/axios/axios/pull/5931/files |
Hello |
the fix for this issue is already available in 3.9.0 thanks to @yutak23 |
Reopened because the #250 has been reverted in 3.9.1 The plan is now to migrate to TS implementation |
This should be fixed in v4.0.0 |
Still happens: "type": "module" tsconfig:
Error in:
Workaround: Use typescript 5.5.4 |
When I try to configure axiosRetry using an axios client as specified in the usage section of the README
I get the following error:
Setup Info:
Platform:
macOS Mojave v10.14.6
Typescript:
v4.1.2
Node.js:
v12.18.3
The text was updated successfully, but these errors were encountered: