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 }