[BUG] [typescript-axios] axios v0.23.0 has breaking changes
Created by: heavenshell
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!