Bug Report
🔎 Search Terms
enum, number, never
🕗 Version & Regression Information
- This changed between versions 3.8.3 and 3.9.7
⏯ Playground Link
Playground link with relevant code
💻 Code
enum E {
a = 1,
b = 2,
}
declare let v: E;
if (v !== 0) {
v &= E.a;
}
🙁 Actual behavior
v is narrowed to never inside the IfStatement. The compound assignment gives a compile error: Type 'number' is not assignable to type 'never'.(2322)
🙂 Expected behavior
v is still of type E and there's no error.
Bug Report
🔎 Search Terms
enum, number, never
🕗 Version & Regression Information
⏯ Playground Link
Playground link with relevant code
💻 Code
🙁 Actual behavior
vis narrowed toneverinside the IfStatement. The compound assignment gives a compile error:Type 'number' is not assignable to type 'never'.(2322)🙂 Expected behavior
vis still of typeEand there's no error.