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

Dont create a union type to infer conditional type branches #30010

Merged
merged 1 commit into from
Feb 26, 2019

Conversation

weswigham
Copy link
Member

Fixes #29945

This was actually substantially simpler to fix than I initially thought. Turns out the only issue is that when we infer from a union to another union, we lop off the common members before inferring to a type parameter in that union. For conditional types, doing this to the union of both branches isn't what we'd like to have happen, so instead we just infer to each branch separately to skip the top level union inference logic.

@CyrusNajmabadi
Copy link
Contributor

This also addresses a core problem we're seeing in #30029

@weswigham weswigham merged commit 2888510 into microsoft:master Feb 26, 2019
@weswigham weswigham deleted the fix-conditional-union-infers branch February 26, 2019 21:43
@falsandtru
Copy link
Contributor

@weswigham Can you also take a look at #30049 #30047?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

A type unified by conditional types loses some types
4 participants