Skip to content

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

Merged
Wesley Wigham (weswigham) merged 1 commit into
microsoft:masterfrom
weswigham:fix-conditional-union-infers
Feb 26, 2019
Merged

Wesley Wigham (weswigham) merged 1 commit into
microsoft:masterfrom
weswigham:fix-conditional-union-infers

Conversation

@weswigham

Copy link
Copy Markdown
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
Copy Markdown
Contributor

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

@weswigham
Wesley Wigham (weswigham) merged commit 2888510 into microsoft:master Feb 26, 2019
@weswigham
Wesley Wigham (weswigham) deleted the fix-conditional-union-infers branch February 26, 2019 21:43
@falsandtru

Copy link
Copy Markdown
Contributor

Wesley Wigham (@weswigham) Can you also take a look at #30049 #30047?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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