hey-api / openapi-ts

🚀 The OpenAPI to TypeScript codegen. Generate clients, SDKs, validators, and more. Support: @mrlubos
https://heyapi.dev
Other
1.36k stars 105 forks source link

Cannot specify responseTransformer when request options include headers #1055

Closed dovca closed 2 months ago

dovca commented 2 months ago

Description

Due to this commit and this line, typescript raises an error when trying to specify responseTransformer along with headers.

ExampleService.getExample({
  headers: {'Accept-Language': 'en'},
  async responseTransformer(data) {
  //    ^^^^^^^^^^^^^^^^^^^ this gets marked as an error
    return data.example
  }
})

The typescript error is:

Object literal may only specify known properties, and responseTransformer does not exist in type

OmitKeys<OptionsBase<true>, 'headers' | 'responseTransformer'> & GetExampleData & Pick<OptionsBase<true>, 'body'>

My question is: Why is responseTransformer omitted from the OptionsBase type?

Reproducible example or configuration

No response

OpenAPI specification (optional)

No response

System information (optional)

No response

mrlubos commented 2 months ago

I've no idea, sorry. Let me remove it.