Hacker News new | past | comments | ask | show | jobs | submit
After several iterations (some of which older than TS native enums if I remember well), this is the Enum code I ended up with. It creates type, "accessors" (`MyEnum.value`), type guard (`isMyENum(...)`) and set of values (`for(const value of MyEnum)`), and have 2 constructor to allow easier transition from TS native enum.

https://gist.github.com/forty/ac392b0413c711eb2d8c628b3e7698...