TLDR Web Dev · ARTICLES & TUTORIALS
TYPESCRIPT ENUMS: USE CASES AND ALTERNATIVES
Summary from the TLDR Web Dev newsletter
TypeScript enums can act as both objects mapping keys to values and types restricting allowed values. Common use cases for enums include creating namespaces for constants and defining custom types with unique values. This post covers exhaustiveness checks and member enumeration for enums and their alternatives, along with when to use enums versus alternative patterns.