★ wanayoo — archive 1999 https://github.com/microsoft/TypeScript/pull/1765Nouvelle recherche | Portail wanayoo
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

Correct handling of union types in expressions #1765

Merged
merged 5 commits into from Jan 21, 2015

Conversation

@ahejlsberg
Copy link
Member

commented Jan 21, 2015

Fixes #1715 (and others like it).

This PR corrects our handling of union types for certain expression operators. Specifically, where operators support operands of certain kinds of types we now also support unions of those kinds of types. For example, in an index access a[x] we now allow x to be a union type such as string | number or Enum1 | Enum2, and in an arithmetic operation such as x * y we allow the operands to be unions composed of enum types.

@JsonFreeman

This comment has been minimized.

Copy link
Contributor

commented on src/compiler/checker.ts in 8573850 Jan 21, 2015

Maybe isTypeOrUnionOfKind? Not a big deal though

@JsonFreeman

This comment has been minimized.

Copy link
Contributor

commented Jan 21, 2015

👍
I will also incorporate this into my PR #1752, specifically commit 7192767

ahejlsberg added a commit that referenced this pull request Jan 21, 2015

Merge pull request #1765 from Microsoft/unionTypeOperations
Correct handling of union types in expressions

@ahejlsberg ahejlsberg merged commit 2052ac3 into master Jan 21, 2015

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details

@ahejlsberg ahejlsberg deleted the unionTypeOperations branch Jan 21, 2015

@microsoft microsoft locked and limited conversation to collaborators Jun 18, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants
You can’t perform that action at this time.