Loading...
A TypeScript enum compiles to a JavaScript object with reverse mapping, adding unnecessary bundle size. For string unions: use as const objects with type Direction = typeof DIRECTIONS[number]. This gives you autocomplete, type safety, and zero runtime overhead. The exception is numeric enums used as bitflags — those benefit from the generated code.
Sign in to join the conversation.