TypeScript didn't invent enums. They exist because it really sucks to write out:
const MyEnum = {
x: 1,
y: 2,
z: 3,
// etc
}
instead of enum MyEnum {
x = 1,
y,
z,
// etc
}
when you want a series of constants each with a unique value but don't particularly care what that value is.TypeScript's enums are particularly weak compared to enums in other languages precisely because there's no JS support for enums. Modern languages have support for ADTs.