Skip to content

Discriminant property checks - #10188

Merged
Anders Hejlsberg (ahejlsberg) merged 2 commits into
masterfrom
discriminantPropertyCheck
Aug 8, 2016
Merged

Anders Hejlsberg (ahejlsberg) merged 2 commits into
masterfrom
discriminantPropertyCheck

Conversation

@ahejlsberg

Copy link
Copy Markdown
Member

This PR formalizes a stricter notion of what is considered a discriminant property. A property of a union type is considered a discriminant property if

  • the type of the property is not identical in each of the constituent types, and
  • the type of the property is a union of unit types.

Because a type guard for a discriminant property of a discriminated union object invalidates preceding type guards for other properties in the same object, it is important to reduce false positives when determining if a property is a discriminant.

Fixes #10169.

@RyanCavanaugh

Copy link
Copy Markdown
Member

👍

@ahejlsberg
Anders Hejlsberg (ahejlsberg) deleted the discriminantPropertyCheck branch August 8, 2016 18:52
@microsoft Microsoft (microsoft) locked and limited conversation to collaborators Jun 19, 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.

3 participants