Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumTypeScriptassertion functionsSingle-choice MCQ

In an exhaustive switch, which signature lets assertNever both catch missed cases at compile time and throw at runtime?

function handle(s: { k: "a" } | { k: "b" }) { switch (s.k) { case "a": return 1; case "b": return 2; default: assertNever(s); } }