TSConfig
noFallthroughCasesInSwitch
Report errors for fallthrough cases in switch statements.
Ensures that any non-empty case inside a switch statement includes either break
, return
, or throw
.
This means you won’t accidentally ship a case fallthrough bug.
tsTry
consta : number = 6;switch (a ) {case 0:Fallthrough case in switch.7029Fallthrough case in switch.console .log ("even");case 1:console .log ("odd");break;}