Skip to content
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

[BUG] [typescript-axios] axios v0.23.0 has breaking changes #10608

Closed
2 of 6 tasks
heavenshell opened this issue Oct 15, 2021 · 0 comments · Fixed by #10626
Closed
2 of 6 tasks

[BUG] [typescript-axios] axios v0.23.0 has breaking changes #10608

heavenshell opened this issue Oct 15, 2021 · 0 comments · Fixed by #10626

Comments

@heavenshell
Copy link

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

axios v0.2.3 was released and has Breaking changes.
https://github.com/axios/axios/releases/tag/v0.23.0
Previous v0.22.0 works fine(No type error)

createRequestFunction() return type is incompatible.

api.ts:3292:13 - error TS2322: Type '(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<unknown, any>>' is not assignable to type '(
axios?: AxiosInstance | undefined, basePath?: string | undefined) => AxiosPromise<User>'.                                                                                         
  Call signature return types 'Promise<AxiosResponse<unknown, any>>' and 'AxiosPromise<User>' are incompatible.                                                                   
    The types of 'then' are incompatible between these types.                                                                                                                     
      Type '<TResult1 = AxiosResponse<unknown, any>, TResult2 = never>(onfulfilled?: ((value: AxiosResponse<unknown, any>) => TResult1 | PromiseLike<TResult1>) | null | undefined
, onrejected?: ((reason: any) => TResult2 | PromiseLike<...>) | ... 1 more ... | undefined) => Promise<...>' is not assignable to type '<TResult1 = AxiosResponse<User, any>, TRes
ult2 = never>(onfulfilled?: ((value: AxiosResponse<User, any>) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<...>
) | ... 1 more ... | undefined) => Promise<...>'.                                                                                                                                 
        Types of parameters 'onfulfilled' and 'onfulfilled' are incompatible.                                                                                                     
          Types of parameters 'value' and 'value' are incompatible.                                                                                                               
            Type 'AxiosResponse<unknown, any>' is not assignable to type 'AxiosResponse<User, any>'.                                                                              
              Type 'unknown' is not assignable to type 'User'.                                                                                                                    
                                                                                                                                                                                  
3292             return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);                                                                          
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I generate typescript-axios client like following.

npx openapi-generator-cli generate -i ./codegen/openapi.yaml -g typescript-axios -o ./src/apis/sample -c ./codegen/config.json"
openapi-generator version

5.2.1

Thank you!

MargieMo pushed a commit to MargieMo/openapi-generator that referenced this issue Nov 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant