Quiz · Narrowing · lesson 10 of 12
Quiz — a forgotten case
What does tsc report for this file?
type Pay = "card" | "cash" | "crypto";
function payName(p: Pay): string {
switch (p) {
case "card":
return "Card";
case "cash":
return "Cash";
default:
const rest: never = p;
return rest;
}
}