ES3 is a poor default for typescript
See original GitHub issueSearch Terms
defaults, ecmascript
Suggestion
The latest available typescript typescript@3.7.2
produces a bunch of unnecessary errors by targeting a very old version of JavaScript:
Error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
Typescript should update the default language version to something more reasonable.
Use Cases
A user install typescript
. They compile a project using tsc
which will fail in most cases. The users discovers that TypeScript targets a 21 year old version of JavaScript by default. They update their compiler options to support and 11 year old version of JavaScript at minimum.
Examples
tsc somefile.ts
working without errors.
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, etc.)
- This feature would agree with the rest of TypeScript’s Design Goals.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:7
- Comments:12 (4 by maintainers)
Top Results From Across the Web
Should I use TypeScript or ES6 to compile to es3/5 [closed]
Am I correct in assuming that I will be able to switch from a typescript codebase to a pure ES6 codebase when it...
Read more >Which version of EcmaScript should I use in the TypeScript ...
Which version of EcmaScript should I use in the TypeScript configuration. TypeScript allows converting most of the ES next features to ES3, ES5...
Read more >Default Exports in JavaScript Modules Are Terrible - Reddit
TypeScript has always allowed you to use modern JavaScript features and supported automatic down level compilation to ES3 with a simple ...
Read more >The Great CoffeeScript to Typescript Migration of 2017
There are companies that pretty much waste millions on poorly ... I was a big fan of coffescript, it was way better than...
Read more >grunt-ts - npm
src, target, string or string[] - glob of TypeScript files to compile. target, option, 'es5' (default), 'es3' , or 'es6' - targeted ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just a note that I’m unsubscribing from this bug as I’m tired of the sarcasm and trolling.
A few points
tsconfig.json
at this point, andtsc --init
does default to ES5moduleResolution
,strictFunctionTypes
,strictNullChecks
, and a few others come to mind as things that should have different defaults “in the future”). Maybe once every 10 years would be a reasonable cadence for that (TypeScript 5.0?)