Many of these problems (some of which I didn't even know about because I avoid using enums) go away when you use union types instead. The implicit casting is one example, the display-name retrieval is another (assuming you use string literals for variants)<p>Some of them can worked around by structuring your code in certain ways (for example you could make sure every variant is covered by indexing into an object with `key in MyEnum`, or by returning from each switch case and requiring a particular return type)<p>But even setting those aside, I got burned so badly the last time I used Flow that I'm not sure anything could convince me to return to it
This is a significant improvement on Typescript’s enums but I wonder what the underlying code it compiles to is.<p>Because we’re planning on moving our codebase to ESM support (the community is moving over quickly), we’ve run into a number of issues with TS enums, the primary one being that TS enums compile to undefined vars that are populated with an IIFE, which disallows using them in certain import/export situations.