Comparing numeric enum to number narrows variable to 'never' #42442
Labels
Bug
A bug in TypeScript
Fix Available
A PR has been opened for this issue
Rescheduled
This issue was previously scheduled to an earlier milestone
Milestone
Bug Report
π Search Terms
enum, number, never
π Version & Regression Information
β― Playground Link
Playground link with relevant code
π» Code
π Actual behavior
v
is narrowed tonever
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 typeE
and there's no error.The text was updated successfully, but these errors were encountered: