Skip to content

Discriminant property checks #10188

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

Merged
merged 2 commits into from
Aug 8, 2016
Merged

Discriminant property checks #10188

merged 2 commits into from
Aug 8, 2016

Conversation

ahejlsberg
Copy link
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
Member

👍

@ahejlsberg ahejlsberg merged commit f6a850b into master Aug 8, 2016
@ahejlsberg ahejlsberg deleted the discriminantPropertyCheck branch August 8, 2016 18:52
@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