Skip to content

Conversation

@ahejlsberg
Copy link
Member

Fixes #8911.


// All winged beasts with legs
if (hasWings(beast)) {
if (beast.legs === 4) { // ERROR TS2339: Property 'legs' does not exist on type 'Winged'.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comments are misleading now.

@mhegazy
Copy link
Contributor

mhegazy commented Jun 8, 2016

👍

}
}

// Repro from #9011
Copy link
Contributor

@yortus yortus Jun 9, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be #9016

@yortus
Copy link
Contributor

yortus commented Jun 9, 2016

This is a really great enhancement to type guards.

@ahejlsberg ahejlsberg merged commit 9e12290 into master Jun 9, 2016
@ahejlsberg ahejlsberg deleted the typeGuardIntersectionTypes branch June 9, 2016 05:14
@yortus
Copy link
Contributor

yortus commented Jun 9, 2016

IMO this is a major improvement to control flow based type inference that should probably be mentioned in the roadmap and in the upcoming 'what's new in TypeScript' for 2.0.

@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.

5 participants