Briefle words · Code & architecture
Enum
Also called enumeration
A type that lists every allowed value for something, so the program can only use one of those values.
Say it to an AI
TypeScript helpers for helpdesk tickets. Model status as a TicketStatus enum (open, pending, resolved, closed) as the single source of truth, type Ticket.status with it, and never compare or assign magic strings. canReply(ticket) and resolve(ticket), both pure.
How an expert would brief the stronger version of “Ticket status”.
See it
Try it as a puzzle →Shared helpers a customer-support helpdesk uses to check and change a ticket's status.
Why: A's TicketStatus enum defines Open, Pending, Resolved and Closed; Ticket.status can only be one of them.
Related words
Room 5 · APIs & data
Learn “Enum” in a five-minute lesson