The string enums don't seem to work the same way as the number enums, there's no 2 way access.
For example.
enum Test { a } let a = Test.a; let b = Test[ 0 ]; // isn't available on the string ones
I wonder why its like that.
For example.
enum Test { a } let a = Test.a; let b = Test[ 0 ]; // isn't available on the string ones
I wonder why its like that.
You could have a situation where you have a string as a code, and then the display name for example, and you can't really do that as is now. This seems more useful than checking for the type (which in a numeric enum is either a number or string, so you would still need to do some work to properly validate it).
var Test;
(function (Test) {
Test[Test["a"] = "RED"] = "a";
})(Test || (Test = {}));
While 2.4 doesn't error out, but omits the inner assignment, thus not allowing the lookup. var Test;
(function (Test) {
Test["a"] = "RED";
})(Test || (Test = {}));