Open this example in the interactive library
Source code
const statuses = ["queued", "running", "done"] as const;
type Status = (typeof statuses)[number];
console.log(((n: (typeof statuses)["length"]) => n)(3));
Sample output
3

Open this example in the interactive library
const statuses = ["queued", "running", "done"] as const;
type Status = (typeof statuses)[number];
console.log(((n: (typeof statuses)["length"]) => n)(3));
3