Open mbebenita opened 9 years ago
TS emits a bit of extra code for enum definitions. For instance:
enum A { x, y, z } var a = A.x;
is compiled to:
var A; (function (A) { A[A["x"] = 0] = "x"; A[A["y"] = 1] = "y"; A[A["z"] = 2] = "z"; })(A || (A = {})); var a = 0 /* x */;
We don't really need to do reverse lookups on enums. Perhaps we could add a compiler option to the TS compiler that omits this code.
Should we file an issue in the TypeScript repo to ask them to add this option?
Looks like this feature already exists in TS:
http://stackoverflow.com/questions/28818849/how-do-the-different-enum-variants-work-in-typescript/28818850#28818850
declare enum
In some cases we might simply use const enum
TS emits a bit of extra code for enum definitions. For instance:
is compiled to:
We don't really need to do reverse lookups on enums. Perhaps we could add a compiler option to the TS compiler that omits this code.