support different strategies for writing enum to TypeScript

It looks like i'm not the only one, who doesn't like to convert java Enums to TypeScript enums.
For example @fgutmann just exported enums as strings, but i don't like that approach either, because i have following goals:

  1. JavaScript object containing field of "enum" must contain enum name instead of ordinal value. This is good for several reasons: a) easy to understand JSON content b) doesn't mess things up, if enum order changes in backend.
  2. I'd still like to write TypeScript as if i was using real enums - type safety, etc.
  3. I should be able to use "reflection" (instanceof) to detect if field is "enum"