mpyw / axios-case-converter

Axios transformer/interceptor that converts snake_case/camelCase
MIT License
160 stars 18 forks source link

AxiosInstance config doesn't match #16

Closed revmischa closed 4 years ago

revmischa commented 4 years ago
Argument of type 'import("xx/node_modules/axios/index").AxiosInstance' is not assignable to parameter of type 'import("xx/node_modules/@types/axios-case-converter/node_modules/axios/index").AxiosInstance'.
  The types of 'defaults.adapter' are incompatible between these types.
    Type 'import("xx/node_modules/axios/index").AxiosAdapter | undefined' is not assignable to type 'import("xx/node_modules/@types/axios-case-converter/node_modules/axios/index").AxiosAdapter | undefined'.
      Type 'import("xx/node_modules/axios/index").AxiosAdapter' is not assignable to type 'import("xx/node_modules/@types/axios-case-converter/node_modules/axios/index").AxiosAdapter'.
        Types of parameters 'config' and 'config' are incompatible.
          Type 'import("xx/node_modules/@types/axios-case-converter/node_modules/axios/index").AxiosRequestConfig' is not assignable to type 'import("xx/node_modules/axios/index").AxiosRequestConfig'.
            Types of property 'method' are incompatible.
              Type 'string | undefined' is not assignable to type '"get" | "GET" | "delete" | "DELETE" | "head" | "HEAD" | "options" | "OPTIONS" | "post" | "POST" | "put" | "PUT" | "patch" | "PATCH" | "link" | "LINK" | "unlink" | "UNLINK" | undefined'.
                Type 'string' is not assignable to type '"get" | "GET" | "delete" | "DELETE" | "head" | "HEAD" | "options" | "OPTIONS" | "post" | "POST" | "put" | "PUT" | "patch" | "PATCH" | "link" | "LINK" | "unlink" | "UNLINK" | undefined'.ts(2345)
michaelbukachi commented 4 years ago

Anybody working on this?

mpyw commented 4 years ago

@types/axios-case-converter - npm

CC @dkniffin

dkniffin commented 4 years ago

I originally created the definitions in this PR: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/32648

I'm no longer using axios or axios-case-converter actively on my projects, so I'm not running into this. Someone else should create a PR over on DefinitelyTyped to fix the issue.

dkniffin commented 4 years ago

Alternatively, it could be a good idea to convert this library to Typescript. Then updates to the library that change types will be much more apparent because they'll error here, rather than in another repo.