TypeScript, the JavaScript-based language that Microsoft devised to make developing large Web applications easier, reached its version 2.0 milestone today.
JavaScript poses certain challenges when used in larger programs. While statically compiled languages such as C#, Java, and C++ perform extensive error-checking every time the developer hits "compile," JavaScript defers all its error checking until a program is run. This means errors ranging from typos to inappropriately attempting to perform mathematical operations on non-numerical data all go completely unchecked until, potentially, an end user is unlucky enough to do the wrong thing. With TypeScript, Microsoft is aiming to introduce some of the same checking and validation that those other languages offer while still remaining compatible with, and compiling to, JavaScript.
Since its introduction, TypeScript has included new features to improve performance, enhance JavaScript compatibility, and extend the range of error checking that the TypeScript compiler performs. TypeScript 2.0 introduces a big step forward here by giving developers greater control over null
values.
null
, used to denote (in some broad, hand-waving sense) that a variable holds no value at all, has been called the billion dollar mistake. Time and time again, programs trip up by not properly checking to see if a variable is null
, and for good or ill, every mainstream programming language continues to support the null
concept.