-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Closed
Labels
area: typescriptoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issue
Description
Feature Request
Is your feature request related to a problem? Please describe.
For now TypeScript will transform enum from
enum Test {
Key = 1
}to
var Test;
(function (Test) {
Test[Test["Key"] = 1] = "Key";
})(Test || (Test = {}));This result is not friendly for uglyify or tree-shaking.
When Test is not be used, the generated code block always remain as dead codes.
Describe the solution you'd like
prefer to generate codes below:
var Test = /*#__PURE__*/(function () {
var e = {}
e[e["Key"] = 1] = "Key";
return e
})();The suggestion version will be removed.
related: microsoft/TypeScript#27604
custom plugin: https://github.com/morlay/babel-plugin-typescript-iife-enum
azizhk, nhardy, ValeryLosik and mischnic
Metadata
Metadata
Assignees
Labels
area: typescriptoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issue
