Incorrect narrowing of union to never
after no-op switch
in while
loop
#47539
Labels
Bug
A bug in TypeScript
Domain: Control Flow
The issue relates to control flow analysis
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
switch while union never
🕗 Version & Regression Information
Playground link with relevant code
💻 Code
🙁 Actual behavior
The code incorrectly checks as OK.
🙂 Expected behavior
The call to
isNever
should fail; on the second iteration of the loopisNever
is invoked with"bbb"
Note that we don't see this behavior with the equivalent
if
:See also #47538
The text was updated successfully, but these errors were encountered: