When using the typescript compiler, there is an option to "preserve const enums", which essentially just treats const enums exactly the same as non-const enums. It would be really useful to have the same feature in the babel transform.
Input Code
export const enum E {
A = 1
}
Babel Configuration (.babelrc, package.json, cli command)
{
"plugins": [
["transform-typescript", {"preserveConstEnums": true}]
]
}
Expected Behavior
export let E;
(function (E) {
E[E["A"] = 1] = "A";
})(E || (E = {}));
Current Behavior
Throws: 'const' enums are not supported
Possible Solution
Add an option that makes const enums behave exactly the same as regular enums.
Context
I want to be able to use babel to transform my typescript in development, as this will be much faster than doing a babel pass and a typescript pass, and babel is needed for other plugins. In production, I can use the slower typescript transform, which handles const enums properly.
When using the typescript compiler, there is an option to "preserve const enums", which essentially just treats const enums exactly the same as non-const enums. It would be really useful to have the same feature in the babel transform.
Input Code
Babel Configuration (.babelrc, package.json, cli command)
Expected Behavior
Current Behavior
Throws: 'const' enums are not supported
Possible Solution
Add an option that makes const enums behave exactly the same as regular enums.
Context
I want to be able to use babel to transform my typescript in development, as this will be much faster than doing a babel pass and a typescript pass, and babel is needed for other plugins. In production, I can use the slower typescript transform, which handles const enums properly.