Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve enum references #2322

Closed
ivogabe opened this issue Mar 12, 2015 · 1 comment
Closed

Preserve enum references #2322

ivogabe opened this issue Mar 12, 2015 · 1 comment
Labels
Duplicate An existing issue was already created

Comments

@ivogabe
Copy link
Contributor

ivogabe commented Mar 12, 2015

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).

@RyanCavanaugh
Copy link
Member

This is the behavior described in #2183.

@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Mar 17, 2015
@microsoft microsoft locked and limited conversation to collaborators Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

2 participants