TypeScript 2.1 ups ease of use, adds expressive code

TypeScript 2.1 ups ease of use, adds expressive code

Microsoft released TypeScript 2.1 Wednesday with upgrades that reduce the friction of starting new projects, more powerful type-checking, and tools to write more expressive code.

TypeScript is a typed superset of JavaScript compiling to plain JavaScript. A release candidate of version 2.1 arrived about a month ago.

Down-level async functions in version 2.1 let developers use async/await and target ECMAScript 3 and 5 without requiring any other tools. Users can write code around promises while not having to use callbacks. "Bringing down-level async/await to TypeScript involved rewriting our emit pipeline to use tree transforms. Keeping parity meant not just that existing emit didn't change, but that TypeScript's emit speed was on par as well," said Daniel Rosenwasser, Microsoft program manager for TypeScript.

Version 2.1 adds mapped types, which are produced by taking a union of literal types and computing properties for a new object type. "They're like list comprehensions in Python, but instead of producing new elements in a list, they produce new properties in a type," said Rosenwasser. Developers using mapped types also no longer have to create new or partial read-only variants of existing types.

Object, rest, and spread functionality in TypeScript 2.1 make it easier to partially copy, merge, and pick apart objects. This capability is planned for ECMAScript 2017, Rosenwasser said. The upgrade also features a key of operator called Index type query that's used like a query for keys on object types. "The dual of this is indexed access types, also called lookup types," said Rosenwasser. "Syntactically, they look exactly like an element access, but are written as types."

TypeScript 2.1 can be installed using NuGet, NPM, or the TypeScript 2.1 Installer for Visual Studio, after accessing Update 3.

IDG Insider


«10 hottest tech skills for 2017


Apple Swift attracts a flock of coding tools»
IDG Connect

IDG Connect tackles the tech stories that matter to you

Recommended for You


Latin America’s push towards digital transformation

Keri Allan looks at the latest trends and technologies


Meeting Owl brings new wisdom to conferencing

Martin Veitch's inside track on today’s tech trends


A rare glimpse inside the Chinese cybercrime underground

Phil Muncaster reports on China and beyond

Our Case Studies

IDG Connect delivers full creative solutions to meet all your demand generatlon needs. These cover the full scope of options, from customized content and lead delivery through to fully integrated campaigns.


Our Marketing Research

Our in-house analyst and editorial team create a range of insights for the global marketing community. These look at IT buying preferences, the latest soclal media trends and other zeitgeist topics.



Should the government regulate Artificial Intelligence?