Before string based enums, many would fall back to objects. Using objects also allows extending of types. For example:
constBasicEvents={Start: "Start",Finish: "Finish"};constAdvEvents={
...BasicEvents,Pause: "Pause",Resume: "Resume"};When switching over to string enums, it"s impossible to achieve this without re-defining the enum.
I would be very useful to be able to do something like this:
enumBasicEvents{Start="Start",Finish="Finish"};// extend enum using "extends" keywordenumAdvEventsextendsBasicEvents{Pause="Pause",Resume="Resume"};Considering that the produced enums are objects, this won"t be too horrible either:
// extend enum using spreadenumAdvEvents{
...BasicEvents,Pause="Pause",Resume="Resume"};
Before string based enums, many would fall back to objects. Using objects also allows extending of types. For example:
When switching over to string enums, it"s impossible to achieve this without re-defining the enum.
I would be very useful to be able to do something like this:
Considering that the produced enums are objects, this won"t be too horrible either: