Microsoft announces the general availability of TypeScript 2.1

Microsoft has announced that TypeScript 2.1 is now generally available. The availability comes with features that Microsoft is claiming can “drastically reduce the friction of starting new projects, make the type-checker much more powerful, and give you the tools to write much more expressive code.”

In case you didn’t already know, TypeScript is a free and open-source programming language developed and maintained by Microsoft. It is a strict superset of JavaScript, and adds optional static typing and class-based object-oriented programming to the language. To install the newest version of TypeScript, all you need to to is use NuGet, or install it through npm by running:

 npm install -g typescript

As a second option, you can also grab up the TypeScript 2.1 installer for Visual Studio 2015 after installing Update 3. TypeScript 2.1 brings many changes and improvements, including, downlevel async/await and significantly improved inference. According to Microsoft, other new and improved features in TypeScript 2.1 include:

  • Async Functions: It bears repeating: downlevel async functions have arrived! That means that you can use async/await and target ES3/ES5 without using any other tools.
  • Object Rest & Spread: We’ve been excited to deliver object rest & spread since its original proposal, and today it’s here in TypeScript 2.1. Object rest & spread is a new proposal for ES2017 that makes it much easier to partially copy, merge, and pick apart objects.
  • keyof and Lookup Types: Many libraries take advantage of the fact that objects are (for the most part) just a map of strings to values. Given what TypeScript knows about each value’s properties, there’s a set of known strings (or keys) that you can use for lookups.
  • Mapped Types
  • Partial, Readonly, Record, and Pick
  • Easier Imports

Please do let us know what you think by dropping us a comment below! And please, keep in mind that Visual Studio Code will usually just prompt you if your TypeScript install is more up-to-date, but you can also follow instructions to use TypeScript 2.1 now with Visual Studio Code or Microsoft’s Sublime Text Plugin.

Share This
Further reading: , ,