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.
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.
The most recent version, TypeScript 1.8, rolled out in February, with quicker compilation and module augmentation.
Sign up for CIO Asia eNewsletters.