What does this program print?

from Literal types
TypeScript 6 beginner 3 min

What does this program print?

TypeScript
const STATES = ["queued", "done"] as const;
type State = (typeof STATES)[number];

function label(state: State): string {
  return state === "done" ? "complete" : "waiting";
}

console.log(STATES.map(label).join(", "));
Open in playground
Report an error