Uh oh!
There was an error while loading. Please reload this page.
Fix primitive narrowing - #8993
Merged
Nathan Shively-Sanders (sandersn) merged 2 commits intoJun 6, 2016
Merged
Conversation
| const enum Tag2 {} | ||
| declare function isNonBlank2(value: string) : value is (string & Tag2); |
There was a problem hiding this comment.
how is string & Tag2 structurally different from just string?
MemberAuthor
There was a problem hiding this comment.
Tag2 is a const enum (making the intersection nominal)
Nathan Shively-Sanders (sandersn)
commented
Jun 6, 2016
Member
👍 |
Nathan Shively-Sanders (sandersn)
commented
Jun 6, 2016
Member
I'll merge since Wesley's still waiting on commit privileges. |
ZpdDG4gta (zpdDG4gta8XKpMCd)
commented
Jun 7, 2016
is this approved by Anders Hejlsberg (@ahejlsberg), can i use it to build upon? |
Nathan Shively-Sanders (sandersn)
commented
Jun 7, 2016
Member
Yes, it turns out there's not much perf hit from this change. However, narrowing will not expand beyond this to methods. That's the performance cliff that Anders Hejlsberg (@ahejlsberg) was thinking of. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes#7224.
Fixes#7441.
This is a re-submission of #7235 without the inversion of the type flag - meaning it simply adds all primitive types and intersection types to the narrowable types list.
Anders Hejlsberg (@ahejlsberg)Nathan Shively-Sanders (@sandersn)