Skip to content

Increase default tsc --init target over time #49206

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
5 tasks done
JoshuaKGoldberg opened this issue May 22, 2022 · 1 comment
Open
5 tasks done

Increase default tsc --init target over time #49206

JoshuaKGoldberg opened this issue May 22, 2022 · 1 comment
Labels
Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Suggestion An idea for TypeScript

Comments

@JoshuaKGoldberg
Copy link
Contributor

Suggestion

πŸ” Search Terms

increase tsc init target es2016 default

βœ… Viability Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.

⭐ Suggestion

As of 2022, all releases within the last year of browsers serving >0.1% of worldwide users support at least all of ECMAScript 2019 and nearly all of ECMAScript 2020-2021, while the LTS-supported versions of Node.js support all of ECMAScript 2021. There's very little reason not to have a target at least as high as "es2019".

How about increasing the default tsc --init value for target in later TypeScript versions over time to match the highest ECMAScript version supported by all LTS Node versions? That'd be "es2021" today.

πŸ“ƒ Motivating Example

Higher targets by default for consumers running tsc --init means they'll be able to use more language features as String.replaceAll by default. It's confusing to tsc --init, then not be able to use them.

πŸ’» Use Cases

Increasing default targets to emit code much cleaner in modern runtimes gives a nicer default output for new TypeScript projects. For beginners to TypeScript in particular, it makes the learning curve a little easier as they won't have to mess with configuration options to be able to use basic features.

This issue is thematically similar to but not the same as #47572 and #47573. Those issue are about changing the default compiler options when no value is specified on the CLI or in a TSConfig file. This issue is about changing the target specified when using tsc --init.

@MartinJohns
Copy link
Contributor

Related / duplicate in spirit: #39308

@andrewbranch andrewbranch added Suggestion An idea for TypeScript Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature labels Jun 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

3 participants