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.
What issue does this pull request resolve?
microsoft/TypeScript#30639 introduced regressions for typescript checking of JSONSchemaType. It was suggested that https://gist.github.com/armanio123/95a33f9ad3286a7d78590eb11af293c4 might improve things. However, that diff removed the usage of
UnionToIntersection
which may be causing most of the regression.After implementing this and cloning the example I saw identical performance for running
tsc
, a little less than 2s on my machine. I'm posting so that the original so that the OP can try this branch out to see if it fixes anything for them.More discussion here
Meant to address #1667
What changes did you make?
Simply split out the types as in the gist.
Is there anything that requires more attention while reviewing?
You could double check I didn't make a mistake, but the tests pass, so this should be fine.