Skip to content

Correct handling of union types in expressions - #1765

Merged
Anders Hejlsberg (ahejlsberg) merged 5 commits into
masterfrom
unionTypeOperations
Jan 21, 2015
Merged

Anders Hejlsberg (ahejlsberg) merged 5 commits into
masterfrom
unionTypeOperations

Conversation

@ahejlsberg

Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Contributor

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

Anders Hejlsberg (ahejlsberg) added a commit that referenced this pull request Jan 21, 2015
Correct handling of union types in expressions
@ahejlsberg
Anders Hejlsberg (ahejlsberg) deleted the unionTypeOperations branch January 21, 2015 23:44
@microsoft 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.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Union types are not allowed in indexers

2 participants