Quiz · A TypeScript project · lesson 10 of 10
Quiz — the order model
Question 1 of 2
Which type does s have on the line return "paid: " + s.total;?
type OrderState =
| { kind: "new" }
| { kind: "paid"; total: number }
| { kind: "shipped"; track: string };
function statusText(s: OrderState): string {
switch (s.kind) {
case "paid":
return "paid: " + s.total;
}
return "other";
}