It’s a good introduction but it’s review in my case - I know how enums work in TS.
But the end conclusion
> Enums in TypeScript are a very useful addition to the JavaScript language when used properly.
> They can help make it clear the intent of normally “magic values” (strings or numbers) that may exist in an application and give a type-safe view of them.
> But like any tool in one’s toolbox, if they are used incorrectly, it can become unclear what they represent and how they should be used.
Doesn’t really support the original post’s premise that prefers not to use enums.
This. Also huge on enums elsewhere, just not in typescript.
I think this could be the reason devs first reach out to enums, since familiarity from other languages.
> Enums : Prefer object const assertion over enum.
But I like enums!
But the end conclusion
> Enums in TypeScript are a very useful addition to the JavaScript language when used properly.
> They can help make it clear the intent of normally “magic values” (strings or numbers) that may exist in an application and give a type-safe view of them.
> But like any tool in one’s toolbox, if they are used incorrectly, it can become unclear what they represent and how they should be used.
Doesn’t really support the original post’s premise that prefers not to use enums.
This. Also huge on enums elsewhere, just not in typescript. I think this could be the reason devs first reach out to enums, since familiarity from other languages.
Deleted Comment