this post was submitted on 10 Oct 2023
2 points (100.0% liked)
TypeScript
825 readers
1 users here now
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Basically, you can use them if you want to, but every single case where you would use them would be better served with a union type.
Another good option is const objects, it's a recommended alternative in the official docs. https://www.typescriptlang.org/docs/handbook/enums.html#objects-vs-enums