Increase default targets over time #47572
Copy link
Copy link
Closed
Labels
In DiscussionNot yet reached consensusNot yet reached consensusSuggestionAn idea for TypeScriptAn idea for TypeScript
Description
Activity
- addedIn DiscussionNot yet reached consensusNot yet reached consensusSuggestionAn idea for TypeScriptAn idea for TypeScript
on Jan 24, 2022 I feel like that tweet could be added as evidence lol
If this is going to introduce a breaking change, how about changing the default target to esnext instead? Then there would be no need to keep changing the default in the future and it would move typescript toward the goal of a type checker instead of transpiler.
Reacted by Wojciech Pawlik, Pyrolistical and dnalborczykConsider also defaulting
stricttotrue.RyanCavanaugh commented
on Feb 23, 2024 MemberMore actionsDefault target in 5.0 is now ES5 and I suspect we might have appetite for ES6 in 6.0
Reacted by Josh Ghoulberg 👻 and StevenThanks Ryan Cavanaugh (@RyanCavanaugh)!
Can you comment on my suggestion about defaulting to
target: "esnext"instead of bumping each release?RyanCavanaugh commented
on Feb 23, 2024 MemberMore actionsESNext includes features that work in 0% of runtimes, like standard decorators. Seems very aggressive.
Metadata
Metadata
Assignees
Labels
In DiscussionNot yet reached consensusNot yet reached consensusSuggestionAn idea for TypeScriptAn idea for TypeScript
Suggestion
🔍 Search Terms
default target es3 es5
✅ Viability Checklist
My suggestion meets these guidelines:
⭐ Suggestion
Continuing #10117: can we increase the default TypeScript target to newer than ES3? Let's say, ES5 to start?
Starting suggestion: how about introducing these breaking changes with TypeScript's major version numbers?
An alternate strategy would be bumping to ES5 first and pushing subsequent releases later. ES2015 is so well-supported, though, it'd be nice to skip straight to supporting
let,const, etc.📃 Motivating Example
I know the TypeScript team is loath to introduce breaking changes, especially when it comes to emit and default settings. Throwing in semantic versioning probably isn't doing this issue any favors either.
But!
for/of, and so on need to be transpiledArray.fromaren't supported in <= ES5This may be a breaking change for projects that target old runtimes and use TypeScript's emit and don't specify target... but that's what major versions are for, right? 😉
💻 Use Cases
Increasing default targets to emit code much cleaner in modern browsers 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.