assertNever(x?: never): never
Utility function for exhaustiveness checking. Use it to get compile-time errors for non-exhaustive switch
statements. Example:
let state: "happy" | "sad" | "mad"; switch(state) { case "happy": return "😀"; case "sad": return "😢"; // case "mad" : return "😠"; default: assertNever(state); // ERROR: // Argument of type '"mad"' is not assignable // to parameter of type 'never'.ts(2345) // // Uncomment the third case to fix the error by making the switch exhaustive. }