microsoft / microsoft/TypeScript
"const" was transformed to "var" when target is "esnext"
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.4k
- Merge medio
- 1g 19h
- PR unite (30g)
- 117
Descrizione
🔎 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"
]
}
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia riproducendo il codice fornito con tsc e il tsconfig.json mostrato, quindi esamina come il compilatore gestisce il destructuring di const quando il target è ESNext. Il lavoro è completato quando il JavaScript emesso mantiene const e non produce l'output var non valido; aggiungi un test di regressione per questo caso se i test esistenti del compilatore nel repository individuano una posizione adatta.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript, typescript
- Ambito
- compilers
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100