Skip to content

const enums not being inlined #89

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

Closed
alj1s opened this issue Jan 25, 2016 · 2 comments
Closed

const enums not being inlined #89

alj1s opened this issue Jan 25, 2016 · 2 comments

Comments

@alj1s
Copy link

alj1s commented Jan 25, 2016

Hi Frank,

Const enums aren't being inlined when bundling. I expect:

declare module crm {
  const enum documentType {
    email = 0,
    unknown = 1
  }
}

var test = crm.documentType.email;

to be converted to:

var test = 0 /* email */

but instead it isn't converted at all.

@frankwallis
Copy link
Owner

My crystal ball tells me you have recently upgraded plugin-typescript...

Unfortunately const enums are not supported by typescript when performing single-file compilation with isolatedModules and that is what the plugin is using to transpile the files. Essentially it is because the value of the enum is not available to the transpiler, see here.

You will have to convert them into real enums and export them from your packages, rather than just defining them in the declaration files I'm afraid.

@alj1s
Copy link
Author

alj1s commented Jan 25, 2016

Thanks Frank. It's like you have a sixth sense...

@alj1s alj1s closed this as completed Jan 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants