Microsoft’s TypeScript 2.0 is due by June

06.04.2016
TypeScript 2.0, the next major version of Microsoft's typed superset of JavaScript, is due by June and will feature non-nullable types.

Among the most requested feature for TypeScript, non-nullable types use a compiler switch called strict null checks, said Anders Hejlsberg, a Microsoft technical fellow and developer of TypeScript. "In strict null checks, we say undefined and null are no longer part of all of the types." A number is a number, a string is a string, and a Boolean is only true or false; it cannot be null or undefined.

As a result of this changes, TypeScript 2.0 will add two new types. One has a single possible value, undefined; the other new type is called null. Union types can be used to join them. "If you want to have a thing that can be number or undefined, you write it as a union type," Hejlsberg said.

Non-nullable and control flow-based types planned for TypeScript feature definite assignment analysis and control flow reflected in the types of local variables. Improved typing acquisitions, meanwhile, use NPM to install type declaration packages. Microsoft chose NPM because it already serves as JavaScript's package manager, Hejlsberg said. NPM can be used to manage dependencies between these declarations.

Other features planned for TypeScript 2.0 include read-only properties and async/await downlevel support. Async/await in TypeScript has enabled asynchronous code flows written as if they were synchronous, removing the need for event handlers or specific callback functions; in November 2015, Microsoft said async/await could be used only by developers targeting Node.js 4 or later.

Hejlsberg also briefly described plans for TypeScript 2.1 and beyond. Features envisioned for these releases include a new JavaScript language service in Microsoft's Visual Studio software development platform and more refactoring support.

The most recent version, TypeScript 1.8, rolled out in February, with quicker compilation and module augmentation.

JavaScript was not engineered for writing large apps, but is not regularly used for the task, Hejlsberg said, which is why TypeScript was created. Built to make JavaScript scale, TypeScript compiles to JavaScript and is used in development of JavaScript frameworks such as Angular and the Dojo Toolkit, he noted. "It's about making it easier to build medium to large apps in JavaScript."

(www.infoworld.com)

Paul Krill

Zur Startseite