-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issueRescheduledThis issue was previously scheduled to an earlier milestoneThis issue was previously scheduled to an earlier milestone
Milestone
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.
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issueRescheduledThis issue was previously scheduled to an earlier milestoneThis issue was previously scheduled to an earlier milestone