TypeScriptintermediate
as const plus a lookup object as a lighter enum
export const Status = { Pending: "pending", Active: "active", Done: "done" } as const;
export type Status = (typeof Status)[keyof typeof Status];
export const describe = (status: Status): string => {Get enum-like values and a matching type from one object literal, without the runtime overhead or the awkward reverse-mapping of enum.