Microsoft/TypeScript
GitHub ã§èŠã"const" was transformed to "var" when target is "esnext"
Open
#59,877 opened on 2024幎9æ6æ¥
BugDomain: JS EmitHelp Wanted
Repository metrics
- Stars
- Â (48,455 stars)
- PR merge metrics
-  (å¹³åããŒãž 6d 17h) (30d ã§ 9 merged PRs)
説æ
ð Search Terms
transform, const, var, target, ECMA, esnext
ð Version & Regression Information
- This is the behavior in every version I tried from Version 5.4 to Version 5.7.0-dev.20240904
⯠Playground Link
No response
ð» Code
export const cilBlurLinear : string [ ] = [ , ]
const [ , ] = cilBlurLinear;
ð Actual behavior
The JS code generated by tsc is as follows:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.cilBlurLinear = void 0;
exports.cilBlurLinear = [,];
var ;
ð Expected behavior
âconstâ should be translated as "const" instead of "var", as the target in my configuration file is "esnext".
Additional information about the issue
tsconfig.json:
{
"compilerOptions": {
"target": "ESNext",
"module": "esnext",
"moduleResolution": "Node",
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"lib": ["es2023","dom"],
"noEmitOnError":true,
"force":true,
"strict":true
},
"include": [
"TScorpus/*"
],
"exclude": [
"node_modules"
]
}