Duolith docs

Errors E0300 to E0399

E0346 A path through the code is not handled

Message {TypeScript's message} (TSnumber)

Words in italics are filled in when the compiler reports it, such as the element's name or the list of known ones.

Why

Some path through this code ends differently from the rest: a switch that misses a member of the union it switches on, a function that returns on some paths and not others, a case that falls through into the next, or code that can never run. A missing case is how a new value of a union slips through unhandled.

How to fix it

Handle every case: add the missing case to the switch, or end the function with a return. To have TypeScript name a missing case, end the switch with default: { const unhandled: never = value; return unhandled; }.

In a terminal

duolith explain E0346

Mentioned in