Automatic skipDefaultLibCheck
(and potentially skipLibCheck
)
#31417
Labels
Domain: lib.d.ts
The issue relates to the different libraries shipped with TypeScript
Domain: Performance
Reports of unusually slow behavior
In Discussion
Not yet reached consensus
Suggestion
An idea for TypeScript
This issue is adapted from a work item discussed at #25658.
Automatic
skipDefaultLibCheck
lib.d.ts
is a pretty big file, and it's only going to grow. Realistically, most people don't ever declare symbols that conflict with the global scope, so we made theskipDefaultLibCheck
(and also theskipLibCheck
flag) for faster compilations.We can suggest this flag to users, but the truth is that it's not discoverable. It's also often misused, so I want to stop recommending it to people. 😄
It'd be interesting to see if we can get the same results of
skipDefaultLibCheck
based on the code users have written. Any program that doesn't contribute a global augmentation, or a declaration in the global scope, doesn't really need to havelib.d.ts
checked over again.@mhegazy and I have discussed this, and it sounds like we have the necessary information after the type-checker undergoes symbol-merging. If no symbols ever get merged outside of lib files, we can make the assumption that
lib
files never need to get checked. But this requires knowing that all lib files have already had symbols merged up front before any other files the compiler is given.Open Questions
declare class B extend A {}
need to be re-checked ifA
has ever been subsequently merged? How would we keep track of that information?Cons
lib.d.ts
wouldn't see erroneous changes in a compiler (so we'd likely need aforceDefaultLibCheck
).Pros
skipDefaultLibCheck
removes anywhere between 400-700ms on my machine from a "Hello world" file, so we could expect the same here under this behavior.forceDefaultLibCheck
, reducing the cost for all other TypeScript users.The text was updated successfully, but these errors were encountered: