DEV Community

Discussion on: How Typescript Enums Work

Collapse
 
adam_cyclones profile image
Adam Crockett 🌀

Full disclosure I'm a long time Typescript developer and super fan. So not looking at this from any other languages, memory footprint is still important even in a GC language like JavaScript.
After many years I still feel enums don't make much sense to me. I always end up using string literals "foo" | "bar" keyof typeof obj or something like that.

Thread Thread
 
smpnjn profile image
Johnny Simpson

Yeah, both are valid, enums can become especially useful in large projects with many developers where you want to standardise the options developers have at their disposal for colours, etc.