Тест · Сужение типов · урок 10 из 12
Тест — забытый вариант
Что сообщит tsc об этом файле?
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;
}
}