Skip to content
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

Defer simplification of conditionals on deferred type references #37423

Conversation

weswigham
Copy link
Member

@weswigham weswigham commented Mar 16, 2020

Fixes #37344

When we started "normalizing" deferred type aliases at the start of comparisons (#35266), we started to eagerly pull on them when we constructed conditional types around them (as conditionals eagerly check to see if they can simplify to their branches in some cases), which means that that normalization actually broke some very common patterns (like the generic action alias in the linked issue). To avoid that break, while still performing that normalization, in this PR, we now unconditionally defer conditionals where the check or extends type is itself a deferred type reference, and then later on perform the simplification of the conditional as part of getReducedType (introduced in #36696), so that deferral isn't witnessed by most consumers of the type.

@weswigham
Copy link
Member Author

@typescript-bot perf test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Mar 16, 2020

Heya @weswigham, I've started to run the perf test suite on this PR at ea74958. You can monitor the build here.

@sandersn sandersn added the For Milestone Bug PRs that fix a bug with a specific milestone label Apr 1, 2020
@sandersn sandersn assigned ahejlsberg and unassigned weswigham Apr 1, 2020
@weswigham weswigham closed this Apr 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Milestone Bug PRs that fix a bug with a specific milestone
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Recursive type alias in union type breaks in 3.8.3
4 participants