Closed
Description
TypeScript Version: 2.3.2
Code
const enum Escape {None, Any}
function scan(): void {
let escape: Escape = Escape.None;
while (true) {
// Error: Operator '===' cannot be applied to types 'Escape.None' and 'Escape.Any'.
escape = escape === Escape.Any ? Escape.None : Escape.Any;
}
}
Expected behavior:
The type to be correctly broadened, since it's in a loop.
Actual behavior:
The error denoted in the code comment above the line in question.