TypeScript-DOM-lib-generator
TypeScript-DOM-lib-generator copied to clipboard
Make things as optional when at least one engine lacks support
From https://github.com/microsoft/TypeScript-DOM-lib-generator/pull/837#issuecomment-808958042.
Currently we add types when at least two browser engines add supports, but that doesn't mean it's available everywhere. Making such types as optional may help devs to feature test as needed.
What do you think? @orta
I think it's more ergonomic to assume it's there, even if it isn't. IMO, we probably shouldn't default to optional.
Perhaps a more general solution is that be that the compiler doesn't raise when you make checks against existing functions which were originally defined in the DOM?
That also sounds good.