microsoft / microsoft/TypeScript

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

Open
#44,144 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Experience Enhancement Suggestion
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

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'. */
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the implementation that generates the tsconfig.json for tsc --init and the mapping used for --target names. Reproduce the command with es2015, then verify that the generated target and its explanatory comment use the expected spelling.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli, compilers
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.