3 ms·
As a nice side effect of fixing this is that it removed the bug where the switch statement didn’t have a break statement.
by martin-adams 4y ago
As a nice side effect of fixing this is that it removed the bug where the switch statement didn’t have a break statement.
- qayxc 4y agoTo be fair, every reasonable linter will treat this as an error or at least a warning and inform the programmer about their blunder. In fact, in TypeScript you don't even need a linter - the compiler itself can be configured to disallow fall-through cases. It's smart about it, too and still allows "empty" cases and makes the last case-statement optional, such that "switch (lorem) { case 'foo': case 'bar': ipsum(); break; case '...': blah(); } is still valid and compiles just fine even with noFallthroughCases configured.