Description
There is already an option to preserve const enums declarations in the generated javascript, but (as far as I know) not an option to preserve references to these enums. Currently enum references are replaced by there integer value. This is fine in most situations, but not in all.
I'm working on a new version of gulp-typescript
that supports multiple versions of TypeScript, and different versions of TypeScript might have different indices for syntax kinds, so I have to keep the references to the enum so at runtime the right number is found. I temporary solved it by casting to any, as you can see here.
Suggestion: add a new option preserveEnumReferences
. When this is active, references to enums will be emitted using normal JavaScript property access (exactly what happens after the work-around with casts).