timocov / ts-transformer-properties-rename

TypeScript custom transformer to rename properties
MIT License
70 stars 3 forks source link

Enums are not renamed causing runtime error #11

Closed 87vrvk9k closed 4 years ago

87vrvk9k commented 4 years ago

Enum members are not renamed, but member access is renamed resulting in potential runtime errors.

export enum TestEnum {
  Test1,
  Test2,
  Test3,
}

Results in:

export var TestEnum;
(function (TestEnum) {
    TestEnum[TestEnum["Test1"] = 0] = "Test1";
    TestEnum[TestEnum["Test2"] = 1] = "Test2";
    TestEnum[TestEnum["Test3"] = 2] = "Test3";
})(TestEnum || (TestEnum = {}));

Member access results in:

console.log(TestEnum._internal_Test1);

Which does not exist.