Overview
With TypeScript 7.0, we have no plans to port over our downleveling from ES2015/ES6 to ES5. ECMAScript 5 was a stable and broad target that seemed like the safest option years ago, but the need to support ES5 environments has shrunk dramatically. Additionally, there is quite a bit of complexity in supporting the transformation of generators.
ES2015 is 10 years old at this point, and is a reasonable lowest target.
Because TypeScript 7.0 will not support --target es5, TypeScript 6.0 will be deprecating it.
That means that TypeScript 6.0 will allow you to use --target es5, but you will receive an error that can only be silenced via ignoreDeprecations.
Users who do rely on ES5 runtimes will be able to use older versions of TypeScript for its downlevel compilation capabilities, Babel, or another compiler. But we do encourage teams to re-evaluate whether they need to support ES5 runtimes.
lib, lib.d.ts, and the DOM libraries
Today, lib.d.ts (TypeScript's nickname for its family of built-in library files) is broken up into many files like lib.es5.d.ts, etc.
Changing the default minimum target means that we need to reconsider what default library files get included based on the target, and how lib continues to function. One complication here is the interplay between whether dom includes dom.iterable, or vice versa.
Most recently, our thinking here is:
es5 continues to exist as a lib target so that it is not an error to reference
- the
es2015 lib options automatically includes es5
- the contents of
dom.iterable effectively gets included as part of using dom
dom.iterable will become empty so that it is not an error to reference
Some experimentation around this is taking place at #62025
--downlevelIteration
--downlevelIteration controls whether or not the JS "iterator protocol" is respected (i.e. using Symbol.iterator and the like) by constructs like array spreads, for/of loops, etc. Otherwise, TypeScript would downlevel these constructs in a naive way (e.g. concat and for loops with counter variables).
But this functionality is just assumed to work in ECMAScript 2015, and the flag does nothing in --target es2015. We may want to issue an error message if this flag is specified in conjunction with any newer target, but it seems unnecessary to do so.
See more deprecation discussions at #54500.
Overview
With TypeScript 7.0, we have no plans to port over our downleveling from ES2015/ES6 to ES5. ECMAScript 5 was a stable and broad target that seemed like the safest option years ago, but the need to support ES5 environments has shrunk dramatically. Additionally, there is quite a bit of complexity in supporting the transformation of generators.
ES2015 is 10 years old at this point, and is a reasonable lowest target.
Because TypeScript 7.0 will not support
--target es5, TypeScript 6.0 will be deprecating it.That means that TypeScript 6.0 will allow you to use
--target es5, but you will receive an error that can only be silenced viaignoreDeprecations.Users who do rely on ES5 runtimes will be able to use older versions of TypeScript for its downlevel compilation capabilities, Babel, or another compiler. But we do encourage teams to re-evaluate whether they need to support ES5 runtimes.
lib,lib.d.ts, and the DOM librariesToday,
lib.d.ts(TypeScript's nickname for its family of built-in library files) is broken up into many files likelib.es5.d.ts, etc.Changing the default minimum target means that we need to reconsider what default library files get included based on the target, and how
libcontinues to function. One complication here is the interplay between whetherdomincludesdom.iterable, or vice versa.Most recently, our thinking here is:
es5continues to exist as alibtarget so that it is not an error to referencees2015liboptions automatically includeses5dom.iterableeffectively gets included as part of usingdomdom.iterablewill become empty so that it is not an error to referenceSome experimentation around this is taking place at #62025
--downlevelIteration--downlevelIterationcontrols whether or not the JS "iterator protocol" is respected (i.e. usingSymbol.iteratorand the like) by constructs like array spreads,for/ofloops, etc. Otherwise, TypeScript would downlevel these constructs in a naive way (e.g.concatandforloops with counter variables).But this functionality is just assumed to work in ECMAScript 2015, and the flag does nothing in
--target es2015. We may want to issue an error message if this flag is specified in conjunction with any newer target, but it seems unnecessary to do so.See more deprecation discussions at #54500.