babel-plugin-typescript-iife-enum
TypeScript icon, indicating that this package has built-in type declarations

0.2.1 • Public • Published

babel-plugin-typescript-iife-enum

Build Status NPM Dependencies License

Purpose

A TypeScript transform to wrapper enum in IIFE.

Purpose

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.

So just wrapper IIFE for enum

const Test = (() => {
    enum Test {
        Key = 1
    }
  
    return Test
})

Notice

must put this plugin before @babel/plugin-transform-typescript

Readme

Keywords

none

Package Sidebar

Install

npm i babel-plugin-typescript-iife-enum

Weekly Downloads

10

Version

0.2.1

License

WTFPL

Unpacked Size

9.24 kB

Total Files

8

Last publish

Collaborators

  • morlay_null