Earlier last week, Microsoft announced a new programming language, TypeScript. This language is a superset of JavaScript designed to make writing large-scale apps in JavaScript easier and faster.

Over the past several years, the size of a typical JavaScript app has grown to be rather large, spanning many files, with tens of thousands of lines of code. Single Page Applications have become a popular way to improve the responsiveness of web applications with one of the best-known examples being Gmail. A language that was once interpreted and used for simple scripts on a web page, is now a hardware-accelerated first-class language for writing complex apps.

When it comes to large applications, however, there are a number of drawbacks to the approach. Without static typing, there’s less tool support for refactoring, compile-time verification, or IntelliSense. Combined, it’s very easy to have typos that won’t be discovered until production, when it’s far more expensive to fix.

TypeScript brings some of the benefits of statically typed languages to JavaScript. The beauty is that as a superset of JavaScript, it is a non-invasive add-on, and all existing JavaScript code today works as TypeScript. The language enables you to annotate your existing code with extra information. The language codifies many well-known patterns in JavaScript and puts “syntactic sugar” around them. For example, classes, interfaces, modules, scoping and lambdas exist as language items that get “compiled” down to the established JavaScript equivalent.

TypeScript ultimately “compiles” down to regular ECMAScript. There’s no extra runtime, no overhead. One way to think about it is like a pre-processor for your JavaScript. One of the goals of TypeScript is to follow the standards body creating ECMAScript 6. While it’ll be at least another year before that’s ready, and then another while before there’s widespread adoption in browsers, TypeScript allows you to use those features today. Think Modernizr for JavaScript.

There are many benefits to using TypeScript: productivity rises with the increased usefulness of IntelliSense and compile-time checking. The signal-to-noise ratio is raised by giving names for the well-known JavaScript patterns and hiding the boilerplate overhead. Modules, scope, visibility, type and lambda notation all get first-class support. You can mix TypeScript and JavaScript in the same file; easily incorporate your existing code. The Type declarations can reside in satellite files so you can still ship clean JS files while providing the type info for those who want it. For Node developers, TypeScript is available as a package, so it integrates with your toolset.

It’s still in its infancy, but the future looks bright. Microsoft has learned from the past and has provided the full source in a Git repository under an Apache 2.0 license. They’ve also put the language under the Open Web Foundation’s Final Specification Agreement. At the same time, they’ve provided syntax support for popular text editors, Sublime, Emacs and Vim.

Given that the ultimate output of TypeScript is vanilla JavaScript, I believe that this is a must-have feature for all JavaScript based development. If you decide to go a different route later, then you still have the JavaScript files and you’re not locked-in in any way.