optimize typescript compiler performance #9471
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR makes TypeScript compiler over 3x faster:
BEFORE:

AFTER:

Long story short, I was looking at some bigger TypeScript repos to play a bit with optimizing TS performance. I generated a trace for the console and found that
react-hook-form
is quite slow (theController
components turned out to be a bottleneck), so I first tried to fix that, but then found this issue: microsoft/TypeScript#46948, and I upgraded TS to see if that helps. Turns out it does! 🔥I also updated the code in a few places to make it work with the newest TS.
Changelog
N/A
Steps to test and verify
Run extended diagnostics to see the improvement.
Limitations, known bugs & workarounds
You could think about excluding Storybook's stories from the ts build (add it to tsconfig and possibly create a separate config for Storybook?). That would improve the time even more.