Title: Increase default targets over time · Issue #47572 · microsoft/TypeScript · GitHub
Open Graph Title: Increase default targets over time · Issue #47572 · microsoft/TypeScript
X Title: Increase default targets over time · Issue #47572 · microsoft/TypeScript
Description: Suggestion 🔍 Search Terms default target es3 es5 ✅ 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 ...
Open Graph Description: Suggestion 🔍 Search Terms default target es3 es5 ✅ Viability Checklist My suggestion meets these guidelines: This wouldn't be a breaking change in existing TypeScript/JavaScript code This wouldn't ...
X Description: Suggestion 🔍 Search Terms default target es3 es5 ✅ Viability Checklist My suggestion meets these guidelines: This wouldn't be a breaking change in existing TypeScript/JavaScript code This would...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/47572
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Increase default targets over time","articleBody":"# Suggestion\r\n\r\n## 🔍 Search Terms\r\n\r\ndefault target es3 es5\r\n\r\n## ✅ Viability Checklist\r\n\r\nMy suggestion meets these guidelines:\r\n\r\n* [x] This wouldn't be a breaking change in existing TypeScript/JavaScript code\r\n* [x] This wouldn't change the runtime behavior of existing JavaScript code\r\n* [x] This could be implemented without emitting different JS based on the types of the expressions\r\n* [x] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)\r\n* [x] This feature would agree with the rest of [TypeScript's Design Goals](https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals).\r\n\r\n## ⭐ Suggestion\r\n\r\nContinuing #10117: can we increase the default TypeScript target to newer than ES3? Let's say, ES5 to start?\r\n\r\nStarting suggestion: how about introducing these breaking changes with TypeScript's major version numbers?\r\n\r\n* Increase to ES2015 for 5.0\r\n* Increase to ES2016 for 6.0\r\n * Alternately, as TypeScript major versions have hit at roughly one every two years, it might make sense to jump two years per version and skip to ES2017\r\n* _...and so on_\r\n\r\nAn 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.\r\n\r\n## 📃 Motivating Example\r\n\r\nI 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.\r\n\r\nBut! \r\n\r\n* ES2015 support is significantly better now than it was a few years ago. [IE is reaching consumer EOL in June 2022](https://blogs.windows.com/windowsexperience/2021/05/19/the-future-of-internet-explorer-on-windows-10-is-in-microsoft-edge). Per https://kangax.github.io/compat-table/es6 all desktop browsers, mobile browsers, and server browsers with \u003e=1% market share have 100% ES2015 syntax support _(I think?)_.\r\n* ES3 and ES5 emit are harder to read than ES2015+ because classes, `for`/`of`, and so on need to be transpiled\r\n* Many runtime APIs such as `Array.from` aren't supported in \u003c= ES5\r\n\r\nThis 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? 😉 \r\n\r\n## 💻 Use Cases\r\n\r\nIncreasing 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.","author":{"url":"https://github.com/JoshuaKGoldberg","@type":"Person","name":"JoshuaKGoldberg"},"datePublished":"2022-01-24T01:48:02.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":6},"url":"https://github.com/47572/TypeScript/issues/47572"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:b75ca703-ad62-4e6b-3d01-d268b33a8070 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D90E:1DEA4C:A280E8:A61544:6A4DB3A0 |
| html-safe-nonce | 0d42f1f535d4b5ab833de3baa82dac7f812677eaff5072a7b6608fd32c8db4fb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEOTBFOjFERUE0QzpBMjgwRTg6QTYxNTQ0OjZBNERCM0EwIiwidmlzaXRvcl9pZCI6IjEzMzcyMDIyNDkzNjU4Mjg1MTIiLCJyZWdpb25fZWRnZSI6InNlYSIsInJlZ2lvbl9yZW5kZXIiOiJzZWEifQ== |
| visitor-hmac | 6720afc6fcc50aac144971216db5aaf7f50d2dfa995774de9646ed053942178d |
| hovercard-subject-tag | issue:1112073712 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/47572/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5d47b4550c03a9684d3cd4cc9a431c8b8d809f804628d57545fed9d3c214341d/microsoft/TypeScript/issues/47572 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5d47b4550c03a9684d3cd4cc9a431c8b8d809f804628d57545fed9d3c214341d/microsoft/TypeScript/issues/47572 |
| og:image:alt | Suggestion 🔍 Search Terms default target es3 es5 ✅ Viability Checklist My suggestion meets these guidelines: This wouldn't be a breaking change in existing TypeScript/JavaScript code This wouldn't ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | JoshuaKGoldberg |
| hostname | github.com |
| expected-hostname | github.com |
| None | 06b8a6144231bf3a234f1c2e9993861e07ce98a905912b114aa386c2d7e84b33 |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 20929025 |
| octolytics-dimension-repository_nwo | microsoft/TypeScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 20929025 |
| octolytics-dimension-repository_network_root_nwo | microsoft/TypeScript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 32f7b614aca06e6bbd89842b1370df1328264f68 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width