string unions
TypeScript in Production notes about string unions
Represent and transform application data
TypeScript Record: Type a Fixed Key Set or an Open Dictionary
Use a finite key union when every named entry is required, and Record<string, Value> when the keys are open-ended.
Represent and transform application data
TypeScript Enums at Runtime: When to Choose Them Over String Unions
Choose a string-literal union for a compile-time restriction, or a regular enum when your code also needs named members and a runtime object.


