Anders Hejlsberg on TypeScript 2 is a new 30 minute discussion video with Anders Hejlsberg describing the upcoming new features in TypeScript 2.0. Here’s a recap of the upcoming features.
Async Await
Javascript uses callback functions to allow a developer to specify the code execute after an asynchronous function executes. This can be implemented various ways such as with an inline function or with “promises”.
In TypeScript 2.0, one can use async await to call an async function and then the code to execute after it finishes comes after it instead of having to use a callback function. It has the “sequential” code style that I prefer.
Non-Null Variables
In Javascript, every variable is nullable which leads to lots of “guard” code to check for nulls and act appropriately. With Non-Null Variables, TypeScript allows a variable to be declared as non-nullable. This reduces the amount of code needed to check for nulls and helps prevent null reference errors.
The “null reference error” is one of most problematic errors in programming. According to Anders, it costs $1 billion dollars annually.
What other TypeScript 2.0 features are you looking forward to? How have you used TypeScript?
Happy Coding,
Luke