Open
Description
Suggestion
I'd like to be able to install @types/web
and have the following happen:
- Other dependencies (like from DT) using something like
/// <reference lib="dom">
do not resolve to the vendoredlibdom.d.ts
- The default inclusion of
dom
in a project vialib
would automatically pick up@types/web
(or be fully suppressed)
🔍 Search Terms
dom types/web web lib
✅ Viability Checklist
My suggestion meets these guidelines:
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- x ] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
- This feature would agree with the rest of TypeScript's Design Goals.
⭐ Suggestion
- Hardcode some sort of
dom
->@types/web
inside the TS compiler's - Support some kind of pragma in
@types/web
1 - Hardcoding
Pros:
@types/web
is a special case (though there could be more in the future) and this could be the smallest possible change.
Cons:
It feels a bit meh.
2 - Pragmas
Pros:
We have existing pragmas: /// <reference no-default-lib="true"/>
for type of thing. This answer is totally generic and would allow others to have their own implementations of other deployed libs.
Cons:
I'd need to check, but this might mean looking for the pragmas across all @types dts files before we can reliably use the files inlib