Typescript and String Enum Support

Now that typescript supports string enums (https://blogs.msdn.microsoft.com/typescript/2017/06/27/announcing-typescript-2-4/) would it not be better to change the string literal syntax from:

export type MessagePriority = "Normal" | "Low" | "High";

to

export enum MessagePriority{
    Normal = "Normal",
    Low = "Low",
   High = "High"
}

This allows them to be used in lists for dropdowns/etc.

We have to wait for a while till everyone catches up to 2.4 as changing it will break existing clients forced to use older TypeScript versions. You can submit a feature request so we can measure interest in it if you want to see it sooner.

For those interested here is the feature request: https://servicestack.uservoice.com/forums/176786-feature-requests/suggestions/30936391-enum-serialization-and-typescript-string-enums

How about a different flag like EnumAsIntString (Probably a better name) ? I will post the feature request.

On a similar topic, having better control over enum serialization for the typescript client (and/or others) would be really helpful. I’d love to be able to get access to the enum description’s in many cases (think about selects) and now it requires creating a webservice to return them when they could easily be created in the service stack client some way.

I added the following comment to the feature request for others that might be interested in voting for it:

I would just add that allowing for options like creating an object instead of a typescript enum would also be helpful for also serializing description attributes. Ideally this would be nice:

Enum MessagePriority { 
[Description("My description")] 
Normal=1, 
High=2 
}

Enums.MessagePriority = [{ key: "Normal", value: 1, description: "My description attribute"},{ key: "High", value: 2, description: ""}]

Main use case is populating drop down lists or anything on the UI that needs to display these lists.