microsoft / microsoft/TypeScript

Change API for compiler option "target" to use strings instead of numbers

Open
#30,604 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Currently, ScriptTarget.ESNext has different values depending on which version of TS you are using.
This makes it very hard for clients of tsserver to resiliently allow users to specify "ESNext" and have it work across changes to ScriptTarget.

After discussing with @RyanCavanaugh and @weswigham, it seems to make sense to change this setting to expect strings instead of numbers, so that moving forward, esnext is interpreted as the version of ES Next supported by that version of TS (i.e. 2019 for 3.3, "2020" for 3.4).

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 tracing how ScriptTarget and the target compiler option are represented and consumed by tsserver. Confirm the expected string interpretation across TypeScript versions and review the issue discussion before changing the API; done means clients can specify values such as "esnext" without relying on version-specific numeric values.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.