TypeScript 2.3: The Sexy Default Type Argument

TypeScript 2.3 is the latest version in the quarterly release cycle from the TypeScript team. This release contains several useful additions to TypeScript which we have already started to leverage within some of our current projects. Let’s take a closer look!

Default type arguments

A seemingly simple change is the ability to provide default values for Generic arguments. The benefit for engineers is that it changes type signatures that might be particularly complex. Here’s an example in which we define the API structure for creating widget structures in Dojo 2, from:

to a more concise, clear and maintainable version of the same concept:

Once we had landed these modifications to support Generic default types, we were able to further refine our approach:

These improvements are simple to implement and are already available in Dojo 2. Within our APIs, there are often default values for information that the API doesn’t actually care about. Default type arguments allow us to stop thinking about unused generics, thus simplifying our type definitions. Sexy, right?!

Type checking in JavaScript files

In one of our previous SitePen podcasts, we discussed at length the negative viewpoint that TypeScript was a system that required typing everything up front. TypeScript 2.3 makes inroads to addressing this complaint and it’s now possible to run TypeScript against JS files using two options:

  • checkJs - type check all JS files in your project
  • @ts-check - a per file comment to check a subset of JS files

Other additions to TS 2.3

Beyond bug fixes and minor improvements, other notable additions to TypeScript 2.3 include:

  • Language server plugin support: support alternative language syntax, such as support for Angular templates, GraphQL, Vue.js, and more
  • Generator and async generator down-emitting for ES3 and ES5
  • Simplifications to configuration and help


The TypeScript team continues to make progress improving the workflow and capabilities of developing with TypeScript. We’ve already updated our work to leverage default type arguments, and we look forward to exploring the language server plugin support in the near future.

Originally published on SitePen.com