microsoft / microsoft/TypeScript

tsc --init --target es2015 generates es6 tsconfig.json

Aperta
#44,144 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Experience Enhancement Suggestion
Lingua principale
Go
Stelle
111k
Fork
14.3k
Merge medio
2g 4h
PR unite (30g)
132

Descrizione

Bug Report

When running tsc --init --target es2015, the generated target is es6.

{
  "compilerOptions": {
    /* Visit https://aka.ms/tsconfig.json to read more about this file */

    /* Basic Options */
    // "incremental": true,                         /* Enable incremental compilation */
    "target": "es6"                                 /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
}

This is unfortunate as the generated file looks as if it was having an invalid option.

🔎 Search Terms

tsc init es2015 es6

🕗 Version & Regression Information

I'm using tsc 4.2.4, and replicated with tsc 4.4.0-dev.20210518

  • I was unable to test this on prior versions because I don't think this is an actual regression. I found b871b5353c8a9ca6dedd6bc84706fd75ed86bae4, and I suspect that this is a left-over.
🙁 Actual behavior
{
  "compilerOptions": {
    "target": "es6"                                 /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
}
🙂 Expected behavior
{
  "compilerOptions": {
    "target": "es2015"                                 /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
}

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia individuando l’implementazione che genera il tsconfig.json per tsc --init e il mapping utilizzato per i nomi di --target. Riproduci il comando con es2015, quindi verifica che il target generato e il relativo commento esplicativo utilizzino la grafia prevista.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
typescript
Ambito
cli, compilers
Tipo di issue
Bug
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
48/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.