Description
Description
I'm writing a client for an api (which I don't control) that uses "default" as the type of the successful response. This isn't included in OkStatus which causes the response to be typed as never.
Reproduction
Generate a schema for this api and create a client from it.
const response = await client.GET("/versions", { params: {}});
console.log(response.data?.specifiedVersion);
This results in the following error: error TS2339: Property 'specifiedVersion' does not exist on type 'never'.
Expected result
No error generated (the code works when the error is ignored).
Checklist
- I’m willing to open a PR (with feedback on whether to fix this in openapi-fetch or openapi-typescript)
Based on this https://spec.openapis.org/oas/v3.0.3#responses-object, I think using default for the success response type is allowed by the spec. I think this could either be fixed by a) adding "default" to OkStatus, or b) by adding logic to openapi-typescript to copy the default response type to a 2XX response if no other successful response type exists. I'm not sure what the unintended consequences of these would be.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status