https://github.com/morlay/babel-plugin-typescript-iife-enum
https://github.com/morlay/babel-plugin-typescript-iife-enum
babel-plugin enum typescript
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/morlay/babel-plugin-typescript-iife-enum
- Owner: morlay
- Created: 2019-01-02T10:19:17.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-08-28T08:45:20.000Z (almost 2 years ago)
- Last Synced: 2024-08-28T10:02:19.452Z (almost 2 years ago)
- Topics: babel-plugin, enum, typescript
- Language: TypeScript
- Size: 158 KB
- Stars: 9
- Watchers: 2
- Forks: 0
- Open Issues: 25
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## babel-plugin-typescript-iife-enum
[](https://travis-ci.org/morlay/babel-plugin-typescript-iife-enum)
[](https://npmjs.org/package/babel-plugin-typescript-iife-enum)
[](https://david-dm.org/morlay/babel-plugin-typescript-iife-enum)
[](https://npmjs.org/package/babel-plugin-typescript-iife-enum)
### Purpose
A TypeScript transform to wrapper enum in IIFE.
### Purpose
For now TypeScript will transform enum from
```ts
enum Test {
Key = 1
}
```
to
```ts
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`