TypeScript 3.6 brings stricter checking to iterators and generators
21 August 2019 | 0
TypeScript 3.6 has stricter checking for generators and iterator functions. Previously, users of generators could not differentiate whether a value was yielded or returned from a generator.
TypeScript 3.6 also improves the experience around
Promises, which are one of the most common ways to interact with asynchronous data. Using a
Promise-oriented API can be confusing. In one example cited, a common mistake is to forget to
await the contents of a
Promise before passing it to another function. Beginning with TypeScript 3.6, specialised error messages will prompt the user to consider using the
TypeScript 3.6 also introduces these improvements and changes:
- To provide a more accurate array spread,
a ___spreadArrayshelper models what happens in ECMAScript 2015 in older targets outside of
- Semicolon-aware code edits are supported. TypeScript is now able to detect whether a file uses semicolons in some editing processes. If a file lacks semicolons, TypeScript will not add them, as it had been doing.
- Many declarations pertinent to DOM updates have been removed or changed with
lib.dom.d.ts. These changes can break existing code.
- TypeScript will only consult immediately preceding JSDoc comments to determine declared types. This too can break existing code.
- Better Unicode support around identifiers when emitting to ECMAScript 2015 and later targets.
setaccessors are allowed in ambient contexts.
- APIs support
- Smarter auto-import syntax, around looking at existing imports before deciding how to import other modules.
You can download the TypeScript 3.6 release candidate through NuGet or use NPM:
npm install -g typescript@rc
IDG News Service