Closed
Description
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.