TypeScript-DOM-lib-generator icon indicating copy to clipboard operation
TypeScript-DOM-lib-generator copied to clipboard

Make things as optional when at least one engine lacks support

Open saschanaz opened this issue 4 years ago • 2 comments

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

saschanaz avatar Mar 29 '21 00:03 saschanaz

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?

orta avatar Mar 29 '21 10:03 orta

That also sounds good.

saschanaz avatar Mar 29 '21 14:03 saschanaz