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

Support for exactOptionalPropertyTypes in tsconfig.json #590

Closed
DonnyVerduijn opened this issue May 17, 2024 · 3 comments
Closed

Support for exactOptionalPropertyTypes in tsconfig.json #590

DonnyVerduijn opened this issue May 17, 2024 · 3 comments
Labels
client Client package related feature 🚀 New feature or request question Further information is requested

Comments

@DonnyVerduijn
Copy link

DonnyVerduijn commented May 17, 2024

Description

Currently, when "exactOptionalPropertyTypes" is enabled in tsconfig.json, the generated files cause TS errors, because formData for example, is provided even though its type is possibly undefined.

A workaround is to add an exclamation mark behind formData as seen in the following example. However it would be great if we would have a better OOTB solution for this problem.

  /**
   * Update firmware
   * @param data The data for the request.
   * @param data.formData Firmware file
   * @returns unknown success
   * @throws ApiError
   */
  public static postFirmware(
    data: PostFirmwareData = {}
  ): CancelablePromise<PostFirmwareResponse> {
    return __request(OpenAPI, {
      method: 'POST',
      url: '/firmware',
      formData: data.formData!,
      mediaType: 'multipart/form-data',
      errors: {
        500: 'server error',
      },
    });
  }
}
@DonnyVerduijn DonnyVerduijn added the feature 🚀 New feature or request label May 17, 2024
@mrlubos mrlubos added the client Client package related label May 17, 2024
@mrlubos
Copy link
Contributor

mrlubos commented May 17, 2024

Let me get to this after clients are done

@mrlubos
Copy link
Contributor

mrlubos commented May 24, 2024

Hey, did you see the new Fetch API client? Wonder if that works for you

@mrlubos mrlubos added the question Further information is requested label May 24, 2024
@DonnyVerduijn
Copy link
Author

This problem is solved by using @hey-api/client-fetch. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client Client package related feature 🚀 New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants