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] Type error due to AxiosRequestConfig headers no longer being optional #14494

Closed
4 of 6 tasks
Alesion30 opened this issue Jan 20, 2023 · 5 comments
Closed
4 of 6 tasks

Comments

@Alesion30
Copy link

Alesion30 commented Jan 20, 2023

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

Using typescript-axios, type error because headers in AxiosRequestConfig is no longer optional since axios@1.2.3.

AxiosRequestConfig(axios@1.2.3)

AxiosRequestConfig(axios@1.2.2)

Type error: Property 'headers' is missing in type '{}' but required in type 'AxiosRequestConfig<any>'.

  35 |          * @throws {RequiredError}
  36 |          */
> 37 |         usersGet: async (options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
     |                          ^
  38 |             const localVarPath = `/users`;
  39 |             // use dummy base URL string because the URL constructor only accepts absolute URLs.
  40 |             const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
openapi-generator version

6.2.1

OpenAPI declaration file content or url
Generation Details

Using openapi-generator-cli.

openapi-generator generate -g typescript-axios -i path/to/openapi.yml -o path/to
Steps to reproduce
Related issues/PRs
Suggest a fix
@Alesion30 Alesion30 changed the title [BUG] Type error: Property 'headers' is missing in type '{}' but required in type 'AxiosRequestConfig<any>'. [BUG][typescript-axios] Type error: Property 'headers' is missing in type '{}' but required in type 'AxiosRequestConfig<any>'. Jan 20, 2023
@Alesion30 Alesion30 changed the title [BUG][typescript-axios] Type error: Property 'headers' is missing in type '{}' but required in type 'AxiosRequestConfig<any>'. [BUG][typescript-axios] Type error due to AxiosRequestConfig headers no longer being optional Jan 20, 2023
@negimatare
Copy link

I'm facing the same issue right now, waiting for any suggestions

@sambernard
Copy link

I'm seeing this as well, and have locked my repos to use 1.2.1.

There's a discussion about this on the axios repo here axios/axios#5476

@bjorgvino
Copy link
Contributor

bjorgvino commented Jan 24, 2023

I believe axios/axios#5420 reverts the non-backwards compatible change in axios between 1.2.1 and 1.2.3 and that version 1.2.4 will fix this issue.

@bjorgvino
Copy link
Contributor

Axios 1.2.4 is out now and I've verified that it fixes this issue for me at least. 🙏🏼

@Alesion30
Copy link
Author

I too can confirm that this issue has been resolved and will close this issue. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants