-
Notifications
You must be signed in to change notification settings - Fork 591
const enum is not work #829
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I believe you are using tsc for compilation, so you should include these additional compile options as below:
If you are using Babel/SWC/Next.j then avoid using const enum and include below :
|
Tks. the problem remains. Perhaps there's another factor. |
What is the current issue |
I changed {
"compilerOptions": {
"module": "amd",
"lib": [
"dom",
"esnext"
],
"target": "esnext",
"removeComments": true,
"outDir": "./dist",
"preserveConstEnums": false,
"isolatedModules": false
},
"include": [
"./src/*.ts"
]
}
var TE;
(function (TE) {
TE[TE["A"] = 1] = "A";
TE[TE["B"] = 2] = "B";
TE[TE["C"] = 3] = "C";
})(TE || (TE = {}));
console.log(TE.A);
console.log(TE.B); Problem:
The output file is expected to have only 2 lines: console.log(1);
console.log(2); |
project like:
tsconfig.json
ismain.ts
istsc
out filemain.js
is:tsgo
out filemain.js
is:it seems compile option
"preserveConstEnums": false
is not work!The text was updated successfully, but these errors were encountered: