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
Use enums when you need enums. Don't use them when you don't need them. What's the issue?
You probably don't ever need enums since the const keyword was added after enums and const objects handle enum use cases unions don't.
You mean const assertions. Well, the thing is that const assertions are not enums. They don't handle enum use cases in any way.
I'm talking about if you want an object syntax for accessing constant types to act as an enum https://www.typescriptlang.org/docs/handbook/enums.html#objects-vs-enums