Interestingly, 2.3 will spit out what you want (but error on the invalid syntax).
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 = {}));