Skip to content

undefined type yields unknown - can it yield never instead? #2028

Answered by drwpow
hesxenon asked this question in Q&A
Discussion options

You must be logged in to vote

Yeah that’s a good suggestion! I would support adding this as a flag, perhaps. This is an opinionated take—we get requests from so many people both asking openapi-typescript to be more flexible in generated types, and people like yourself that request more strictness. We generally try and err on the side of strictness, but never[] may be a little too restrictive for some folks as default behavior.

For things like this, I can’t recommend Redocly’s linting API enough—it can improve quality and consistency of OpenAPI schemas far better than openapi-typescript can. Agree that often people can find ways to improve their schemas when the generated types turn out to be different than expected, b…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@hesxenon
Comment options

Answer selected by hesxenon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants