Skip to content

Logical Assignment Operator should be a definite assignment kind #39088

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

Closed
Kingwl opened this issue Jun 16, 2020 · 0 comments · Fixed by #39087
Closed

Logical Assignment Operator should be a definite assignment kind #39088

Kingwl opened this issue Jun 16, 2020 · 0 comments · Fixed by #39087
Assignees
Labels
Bug A bug in TypeScript

Comments

@Kingwl
Copy link
Contributor

Kingwl commented Jun 16, 2020

TypeScript Version: 3.7.x-dev.201xxxxx

Search Terms:
assignment operator, type
Code
#37255 (comment)

// A *self-contained* demonstration of the problem follows...
// Test this by running `tsc` on the command-line, rather than through another build tool such as Gulp, Webpack, etc.
let x: { a?: boolean } = {};

x.a ??= true;
x.a &&= false;
^^^ Type 'false' is not assignable to type 'true'.(2322)

Expected behavior:
Works

Actual behavior:
Type 'false' is not assignable to type 'true'.(2322)

Playground Link:

Related Issues:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants