It's Friday – and that means one thing: Yup, Microsoft's TypeScript 2.0 is out
TypeScript first appeared in October 2012, and is a project backed by Microsoft’s Anders Heljsberg – the inventor of C# and before that Borland’s Delphi.
TypeScript received a significant boost in March 2015 when the team behind the Google-sponsored Angular project, an open-source web application framework, adopted TypeScript for Angular 2. The release version of Angular 2 was announced on September 15, 2016.
The TypeScript project is hosted on GitHub.com, where it is the 15th most popular language according to the number of Pull Requests, with 250 per cent growth year on year, just behind Apple's Swift language.
The most notable feature in TypeScript 2.0 is non-nullable types. Variables with a value of null are a common source of programming errors, so much so that computer scientist Tony Hoare, who introduced null references in ALGOL W in 1965, described it as his "billion dollar mistake."
strictNullChecks, TypeScript variables become non-nullable by default. The compiler will check both for variables set to null, and for the common problem of variables that are used before a value has been assigned.
It is still possible to have nullable types in TypeScript 2.0, by declaring a variable as a union such as "number or null", expressed as
let x: number | null. The TypeScript team also had to set non-nullable types off by default because it is a change that breaks existing code.
Other changes include the ability to define properties as read-only, private and protected class constructors, and a new type called never which is used for values that never occur. The full list of new features are documented here. ®