Skip to content

Allow boolean literals to be generated from contextual types again #21503

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
Feb 1, 2018

Conversation

weswigham
Copy link
Member

This removes the exception for boolean from the checks in isLiteralOfContextualType. This causes us to infer boolean literals in more places (as expected and sometimes necessary), but I don't see any tests broken by this change, so it seems fine.

Fixes #21436
Fixes #21427

Verified

This commit was signed with the committer’s verified signature.
weswigham Wesley Wigham

Verified

This commit was signed with the committer’s verified signature.
weswigham Wesley Wigham
@@ -15,7 +15,7 @@ var numStrTuple2: [number, string] = [5, "foo", true];

var numStrBoolTuple: [number, string, boolean] = [5, "foo", true];
>numStrBoolTuple : [number, string, boolean]
>[5, "foo", true] : [number, string, boolean]
>[5, "foo", true] : [number, string, true]
Copy link
Contributor

Choose a reason for hiding this comment

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

this was the reason we made this original change... to make the error messages look nicer. but i guess we can not differentiate between true | false and boolean in any meaningful manner.

@mhegazy
Copy link
Contributor

mhegazy commented Feb 1, 2018

Please port to release-2.7 as well.

@weswigham weswigham merged commit 058b2f7 into microsoft:master Feb 1, 2018
@weswigham weswigham deleted the boolean-literal-narrowing branch February 1, 2018 20:34
weswigham added a commit to weswigham/TypeScript that referenced this pull request Feb 1, 2018

Verified

This commit was signed with the committer’s verified signature.
weswigham Wesley Wigham
…icrosoft#21503)

* Allow boolean literals to be generated from contextual types again

* Update fourslash test
weswigham added a commit to weswigham/TypeScript that referenced this pull request Feb 1, 2018

Verified

This commit was signed with the committer’s verified signature.
weswigham Wesley Wigham
…icrosoft#21503)

* Allow boolean literals to be generated from contextual types again

* Update fourslash test
weswigham added a commit that referenced this pull request Feb 1, 2018

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
…21503) (#21548)

* Allow boolean literals to be generated from contextual types again

* Update fourslash test
@microsoft microsoft locked and limited conversation to collaborators Jul 3, 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.

None yet

3 participants