TypeScript-DOM-lib-generator
TypeScript-DOM-lib-generator copied to clipboard
Make DOM types available without polluting the global scope with 790 global variables
Adding lib: ['DOM'] introduces 790 global variables. Many of these are deprecated and useless. Many of them have short names that can hide mistakes like a missing var or let. Some obvious offenders that absolutely result in regular bugs:
eventclosedparentscreenstatustoolbartoplengthselfhistorylocationorigin
For this reason I have so far refrained from using lib: ['DOM'] in my projects and prefer to access all globals via window.foo instead for clarity and safety.
However, this means that TS doesn't know about any of these types. Please can we make these types available so that we can at least access and use the type information without polluting the global scope with all these variables.
I'd be happy with one that just declares document and window globals, or a types-only version that leave all globals up to us, either way I don't mind, just anything that makes the types available without all these junk globals.