Microsoft emphasizes JavaScript tools, libraries in TypeScript 2.0

The latest version of Microsoft's typed JavaScript superset adds simplified declaration file acquisition and non-nullable types

Microsoft emphasizes JavaScript tools, libraries in TypeScript 2.0

Microsoft is now shipping TypeScript 2.0, an upgrade to the company's typed superset of JavaScript. It can be downloaded for Visual Studio 2015 Update 3, accessed by NuGet, used with with Visual Studio Code, or installed via NPM.

Version 2.0 focuses on developer productivity, alignment with the ECMAscript standard underlying JavaScript, and support for JavaScript libraries and tools, the TypeScript team said.

Compiling to JavaScript and now serving as the underpinning of Google's Angular 2 JavaScript framework, TypeScript features the same syntax and semantics familiar to JavaScript developers, but also offers types.  It is part of a roster of JavaScript alternatives, such as CoffeeScript, that are seen as easier for developers.

Key improvements in TypeScript 2.0 include simplified declaration file acquisition, in which declarations for a library are made easier, and non-nullable types, in which null and undefined have their own types for developers to express when null/undefined values are acceptable. "Because this is a breaking change, we've added a --strictNullChecks mode to opt into this behavior. However, going forward it will be a general best practice to turn this flag on as it will help catch a wide range of null/undefined errors."

Control flow analyzed types in version 2.0 can produce the most specific type possible. "When combined with non-nullable types, TypeScript can now do much more complex checks, like definite assignment analysis." Also, immutable programming has been made easier in version 2.0 by declaring properties read-only.

The first beta version of TypeScript 2.0, which postponed delivery of async support until TypeScript 2.1, was released in July. In future versions, TypeScript's builders plan to evolve the type system to allow further expression of JavaScript in a statically typed fashion. The TypeScript language service and tooling features will be enhanced so tools can become "smarter," the team said.

Copyright © 2016 IDG Communications, Inc.

How to choose a low-code development platform