Closed
Description
TypeScript Version: 3.3.3 to Nightly
Search Terms:
- Boolean
- Iteration
- Inference
Code
let value = false;
['a', 'b', 'c'].forEach(str => {
if (str === 'b') {
value = true;
}
})
console.log(value)Expected behavior: Type inspection (mouse on variable) should say that value type is a boolean as the variable can clearly take both true and false values.
Actual behavior: It says value can only be false, even after conditionnaly set value to true.
Related Issues: Not found, let me know if there is already one.
Metadata
Metadata
Assignees
Labels
No labels