Dev Helpers
← Back

Exclude the terminal state

Exclude the terminal state using TypeScript.

Open this example in the interactive library

Source code

const statuses = ["queued", "running", "done"] as const;
type Status = (typeof statuses)[number];
console.log(((s: Exclude<Status, "done">) => s)("running"));

Sample output

running