Dev Helpers
← Back

Extract just the terminal state

Extract just 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: Extract<Status, "done">) => s)("done"));

Sample output

done