Numeric and string enums compile to runtime objects. Many teams prefer as const objects or union literals instead—zero runtime cost.
Modern alternative
const Direction = { Up: 'UP', Down: 'DOWN' } as const;
type Direction = typeof Direction[keyof typeof Direction];
This gives union literals without emitting a runtime enum object—smaller bundles and clearer tree-shaking.
Self-check
- When might a string enum still be justified?
Practice: Apply enums in the playground, then explain enums in one sentence without looking at notes.