Search Terms
lib.dom.d.ts, split, modular
Suggestion
I'm currently writing a TypeScript definition file for the API of a game, which will be submitted to DefinitelyTyped soon.
The API of the game exposes a Notification class to the global scope, which collides with the one in "lib.dom.d.ts" definition file. Not only that, but it also uses jQuery and XMLHttpRequest, forcing me to include that definition file.
Use Cases
By splitting the "lib.dom.d.ts" definition file apart, user can select only the APIs they need.
This change should not break the backward compatibility of old projects, although old versions of TypeScript will not support projects using the modular definition file.
Examples
For example, the "lib.dom.d.ts" definition file could be split up like this:
lib.dom.d.ts
|-- lib.dom.elements.d.ts
|-- lib.dom.notification.d.ts
|-- lib.dom.xhr.d.ts
`-- ... (other modules)
When some parts of the user's definition file collide with the "lib.dom.d.ts" definition file, the user can use the following instead:
Checklist
My suggestion meets these guidelines:
Search Terms
lib.dom.d.ts, split, modular
Suggestion
I'm currently writing a TypeScript definition file for the API of a game, which will be submitted to DefinitelyTyped soon.
The API of the game exposes a
Notificationclass to the global scope, which collides with the one in "lib.dom.d.ts" definition file. Not only that, but it also uses jQuery andXMLHttpRequest, forcing me to include that definition file.Use Cases
By splitting the "lib.dom.d.ts" definition file apart, user can select only the APIs they need.
This change should not break the backward compatibility of old projects, although old versions of TypeScript will not support projects using the modular definition file.
Examples
For example, the "lib.dom.d.ts" definition file could be split up like this:
When some parts of the user's definition file collide with the "lib.dom.d.ts" definition file, the user can use the following instead:
{ "compilerOptions": { "lib": [ "DOM.Elements", "DOM.XHR", ... // (other modules except for "DOM.Notification") ] ... } ... }Checklist
My suggestion meets these guidelines: