TypeScript 2.3 Released
Written by Ian Elliot   
Tuesday, 02 May 2017

The latest release of Microsoft’s open source typed superset of JavaScript is now available. TypeScript 2.3 features generators and iteration for ES5/ES3, generic parameter defaults and more. 


According to Daniel Rosenwasser, writing on the MSDN Blog, 

Previously, TypeScript didn’t support compiling generators or working with iterators. With TypeScript 2.3, it not only supports both, it also brings support for ECMAScript’s new async generators and async iterators.

The difference between AsyncIterator and Iterator is that the nextreturn, and throw methods of an AsyncIterator return a Promise for the iteration result, rather than the result itself. This allows the caller to enlist in an asynchronous notification for the time at which the AsyncIterator has advanced to the point of yielding a value. An AsyncIterator has the following form:


TypeScript 2.3 adds support for declaring defaults for generic type parameters, which can eliminate a lot of typing. A generic parameter default follows the following rules:


  • A type parameter is deemed optional if it has a default.

  • Required type parameters must not follow optional type parameters.

  • Default types for a type parameter must satisfy the constraint for the type parameter, if it exists.

  • When specifying type arguments, you are only required to specify type arguments for the required type parameters. Unspecified type parameters will resolve to their default types.

  • If a default type is specified and inference cannot chose a candidate, the default type is inferred.

  • A class or interface declaration that merges with an existing class or interface declaration may introduce a default for an existing type parameter.

  • A class or interface declaration that merges with an existing class or interface declaration may introduce a new type parameter as long as it specifies a default.

For Rosenwasser, a new type checking mode using comments to specify types on regular JavaScript declarations. comes top of the list of the new features. He writes:

TypeScript has long had an option for gradually migrating your files from JavaScript to TypeScript using the --allowJs flag; however, one of the common pain-points we heard from JavaScript users was that migrating JavaScript codebases and getting early benefits from TypeScript was difficult. That’s why in TypeScript 2.3, we’re experimenting with a new “soft” form of checking in .js files, which brings many of the advantages of writing TypeScript without actually writing .ts files.

Instead, all you need to do to type-check a file is to add a comment with // @ts-check to the top.

Rosenwasser also explains how TypeScript 2.3 makes it easier for getting  started with Typescript and discovering its features. This comes as a response to finding that  people were often unaware that TypeScript could work on JavaScript files, or that it could catch nullability errors. To make TypeScript more accessible, help output has been improved so that options are grouped by their topics, and more involved/less common options are skipped by default and init output lists potential options in comments.

To provide optimal developer experience TypeScript 2.3 introduces a new --strict flag which will be turned on by default for all new projects started with tsc --init. It enables the following settings:








The final of these enforces JavaScript strict mode in all files.


According to the TypeScript Roadmap, the next release of the language, version 2.4, will include covariant checking for callback parameters, string enums, refactoring support in Language Service API, and better error reporting.


More Information

What's New In TypeScript

Announcing TypeScript 2.3

TypeScript Roadmap

Related Articles

TypeScript 2.2 Adds More Code Actions

TypeScript 2.0 Adds Null, Undefined And Never  

TypeScript 1.8 Hits Beta

TypeScript Goes Light, Moves To GitHub 

TypeScript Fully Accepted into Visual Studio 


To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.


Grafana Releases Loki 3

Grafana has announced the release of Loki 3, with improvements including query acceleration with Bloom filters and native OpenTelemetry support.

Linus Torvalds Over Flows On Overflows In C

You may think of Linus Torvalds as the Linux guru, but he is also a leading expert on C and often ignored and misunderstood in this role. A recent exchange on the Linux Kernel mailing list demonstrate [ ... ]

More News

raspberry pi books



or email your comment to: comments@i-programmer.info


Last Updated ( Saturday, 19 August 2017 )