"type": "object"
With No Addtional Properties Generates Object Allowing Any Properties of Type Unknown
#1183
Labels
bug 🔥
Something isn't working
prioritized 🚚
This issue has been prioritized and will be worked on soon
Milestone
Description
For a schema with
"additionalProperties": false
, the generator produces an object that allows any properties with typeunknown
:In my use case (OpenAPI spec in Stackblitz in swagger-usecase.json), this leads to issues where a type extends another type with any properties:
Instead, I would expect
"additionalProperties": false
to generate the following:That way, checks like
'otherProperty' in product
would actually work and narrow down the type.However, I am unsure if this would work in all cases, or if
unknown
is correct in some cases.Reproducible example or configuration
https://stackblitz.com/edit/hey-api-openapi-ts-additional-properties-bug-repro?file=src%2Fclient%2Ftypes.gen.ts&view=editor
OpenAPI specification (optional)
System information (optional)
The text was updated successfully, but these errors were encountered: