We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
exactOptionalPropertyTypes
In TypeScript, by default, if you have an optional field like: { x?: number } then it allows any of: { x: 5 }, { x: undefined }, {}
{ x?: number }
{ x: 5 }
{ x: undefined }
{}
There is an option called exactOptionalPropertyTypes, which makes { x: undefined } invalid, allowing only: { x: 5 }, {}
However { x: undefined } is allowed by the rules of WebIDL, so all of our optional fields need to be written like: { x?: undefined | number }
{ x?: undefined | number }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
In TypeScript, by default, if you have an optional field like:
{ x?: number }
then it allows any of:
{ x: 5 }
,{ x: undefined }
,{}
There is an option called
exactOptionalPropertyTypes
, which makes{ x: undefined }
invalid, allowing only:{ x: 5 }
,{}
However
{ x: undefined }
is allowed by the rules of WebIDL, so all of our optional fields need to be written like:{ x?: undefined | number }
The text was updated successfully, but these errors were encountered: