Closed
Description
TypeScript Version: 2.9.1, 3.0-rc
Search Terms: unreachable remove fix
Code
while (true) {
console.log(1);
break;
console.log(2); // unreachable
}
Expected behavior:
"Remove unreachable code" fix should only remove the code after "break".
Actual behavior:
The fix removes the whole loop.
I guess the idea was that the body of an if (false)
or while (false)
is considered unreachable, and in that case the whole thing can be removed. But, that's not the case here.