Error class that produces a compile-time error if cases for a value
weren’t covered exhaustively (e.g. via switch).
enumColor { Red, Green } functioncolorToString(color: Color) { switch (color) { caseColor.Red: return'RED'; default: // @ts-expect-error: Argument of type 'Color.Green' is not // assignable to parameter of type 'never'. thrownewUnexpectedValueError(color); } }
Error class that produces a compile-time error if cases for a value weren’t covered exhaustively (e.g. via
switch
).