| > seeing `Direction.North` is a whole lot more semantically meaningful than the string "north" in code This is subjective, so we can agree to disagree, but personally assuming I have typechecking/autocomplete I really prefer knowing exactly what I have (a string), and not hiding it behind an abstraction And, if you ever just want the values enumerated for whatever reason, you can always do it yourself explicitly: const Direction = {
North: 'North',
South: 'South',
East: 'East',
West: 'West'
} as const
type Direction = keyof typeof Direction
Compared with the above, the special enum syntax just creates unnecessary magic in my opinion; it even breaks TypeScript's rule of not having any runtime footprint> More than that, refactoring tooling Just Works with enums I just entered the following in my editor: type MyEnum = 'A' | 'B' | 'C'
const x: MyEnum = 'A'
1. When I typed open-quote in front of `=`, it intellisensed/autocompleted on the possible strings2. I was able to right-click 'A' in the type definition, click "Rename...", and then it updated both the type and the 'A' literal value with the new value |
As for the readability, it gets a little more interesting when you are interacting with libraries or APIs outside of your control; you end up with hyphenated things, underscored, and other oddities that may not be a one-to-one match between a logical, easily readable key and the underlying value it represents.