-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build: Enable TypeScript skipDefaultLibCheck #63056
Conversation
This skips _checking_ types that are bundled with TypeScript. We should be able to trust these types, so they can be used without checking them. Many packages use the DOM types and this appeared as a hot spot when analyzing the TypeScript build. Adding this configuration should improve TypeScript build performance.
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice improvement 👍 Just one little question before we 🚀
@@ -14,6 +14,8 @@ | |||
"emitDeclarationOnly": true, | |||
"isolatedModules": true, | |||
|
|||
"skipDefaultLibCheck": true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TS doc recommends that we use skipLibCheck
instead. Any good reason to prefer skipDefaultLibCheck
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that, I'm not sure why they recommend that.
skipLibCheck
ensures that the libraries we depend on typecheck. I understand that skipDefaultLibCheck
only skips checking bundle libs (like DOM, ES2020, etc.). These libs are bundled with TypeScript and they should be the highest quality.
With other libs that come from other node_modules, it seems best to check their types especially because if we don't check these files, the errors can appear in other projects that have skipLibCheck
disabled. We've seen that packages become stale or have conflicting types that we need to address, I dealt with a lot of this recently in #61486 and related PRs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense to me. Seems like TS docs need some love!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm seeing a ~8s and ~10s improvement respectively on 2 runs 👍 Let's go for it 🚀
Skip checking types that are bundled with TypeScript. We should be able to trust these types, so they can be used without checking. Many packages use the DOM types and this appeared as a hot spot when analyzing the TypeScript build. Adding this configuration should improve TypeScript build performance. --- Co-authored-by: sirreal <jonsurrell@git.wordpress.org> Co-authored-by: tyxla <tyxla@git.wordpress.org>
What?
Enabling this configuration should improve TypeScript build performance with few or no downsides.
Why?
This skips checking types that are bundled with TypeScript. We should
be able to trust these types, so they can be used without checking them.
Many packages use the DOM types and this appeared as a hot spot when
analyzing the TypeScript build.
Adding this configuration should improve TypeScript build performance.
Benchmark
Run
./node_modules/.bin/tsc --build --force
, which is a build without caches:branch
trunk
That's a ~10s build improvement on my machine.
Testing Instructions
CI passes.