Paul Krill
Editor at Large

TypeScript 3.6 brings stricter checking to iterators and generators

news
Aug 29, 20192 mins

The latest TypeScript version also introduces improvements for working with arrays and promises

Referee shot from below on football field
Credit: Thinkstock

TypeScript 3.6, the latest version of Microsoft’s typed superset of JavaScript, is now available as a production release. It brings stricter checking of iterators and generators and an improved user experience around promises. 

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 .then() or await the contents of a Promise before passing it to another function. Beginning with TypeScript 3.6, specialized error messages will prompt the user to consider using the await keyword.

TypeScript 3.6 also introduces these improvements and changes:

  • To provide a more accurate array spread, a ___spreadArrays helper models what happens in ECMAScript 2015 in older targets outside of downlevelIteration
  • 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 exsting 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.
  • The get and set accessors are allowed in ambient contexts.
  • APIs support --build and --incremental.
  • Smarter auto-import syntax, around looking at existing imports before deciding how to import other modules.

You can download TypeScript 3.6 through NuGet or use NPM:

npm install -g typescript
Paul Krill

Paul Krill is editor at large at InfoWorld. Paul has been covering computer technology as a news and feature reporter for more than 35 years, including 30 years at InfoWorld. He has specialized in coverage of software development tools and technologies since the 1990s, and he continues to lead InfoWorld’s news coverage of software development platforms including Java and .NET and programming languages including JavaScript, TypeScript, PHP, Python, Ruby, Rust, and Go. Long trusted as a reporter who prioritizes accuracy, integrity, and the best interests of readers, Paul is sought out by technology companies and industry organizations who want to reach InfoWorld’s audience of software developers and other information technology professionals. Paul has won a “Best Technology News Coverage” award from IDG.

More from this author