Microsoft Announces TypeScript: Will It Change The Web?

Like it or not, JavaScript has long established itself as a de-facto scripting language on the web. There are many programmers who are in love with JavaScript, and then there is an equal number of programmers who hate it. Yet, if you are developing for the web, you most probably deal with JavaScript in some way or another, at some point or the other.

Owing to such popularity, JavaScript has seen its fair share of clones copies languages that attempt to replace or build upon JS. CoffeeScript is a shining example, for instance.

Among such examples, we recently saw a new entrant few days ago. Yes, Microsoft announced the release of TypeScript, a typed superset of JavaScript.

What is it all about? Read on as we take a look at it in this article!

TypeScript: An Introduction

So, what exactly is TypeScript? As it becomes clear, TypeScript is a language for application-level JavaScript development. It is based on JavaScript, complies to JavaScript, but is better than JavaScript (or at least that’s what folks at Microsoft want us to believe).

Basically, in its purest form, JavaScript lacks certain features that are otherwise common: for example, in-built module system and static type checking aren’t present in JavaScript. TypeScript wishes to build upon these very areas.

Certain noteworthy features include:

  1. Class declarations
  2. Support for modules
  3. Optional static typing
  4. Visual Studio plugin

The language is scalable and open source and comes with an Apache 2.0 license. Another shocking point, isn’t it? Microsoft hasn’t been known for its open source ventures ever. In fact, its products such as Windows and IE often receive the maximum amount of hatred from the open source community.

TypeScript: The Reasons

Why exactly did Microsoft feel the need for launching TypeScript? This is one question that only MS can answer. We shall, however, try our best to figure it out.

Google already had come up with its own answer to the problems related to JavaScript in the form of Google Dart. Couldn’t MS simply back Dart and support it, rather than wasting its time and energy on a new language? Probably not. Firstly, MS will not bother backing its rival Google’s creation. Secondly, Dart is known for exhibiting a radical departure from JavaScript (to the extent that many feel Dart aims to replace JavaScript altogether). Naturally, if Microsoft were to address the JavaScript user base, going with Dart wouldn’t have helped.

However, one wonders, if Dart was not serving the purpose, why wasn’t CoffeeScript considered? Also, on a related note, did JavaScript really need stuff such as static typing?

However, business and opinion questions apart, Microsoft does indeed have a practical interest in JavaScript. First up, both Bing Maps and MS Office Web Apps have something or the other to do with JavaScript, and the development teams for both these products have had their share of confusion with it. In fact, it is this very practical need — the upcoming projects’ reliance on JavaScript — that led to Microsoft’s interests in TypeScript development.

Furthermore, with the desktop OS being replaced by the internet OS (read: Windows no longer a dominant monopoly), Microsoft at least wishes to present Visual Studio as a legit entity, and offering an open source TypeScript with some added awesomeness is both a smart and noble (clever?) move.

TypeScript: The Details

Basically, TypeScript is a super set of JavaScript: you can write JS code within TS, and no one will declare you guilty. That said, as mentioned above, TypeScript offers additional goodness and features that are otherwise lacking in JavaScript. Unlike Dart, TypeScript does not provide you with new syntax rules: it accepts all that is good in JavaScript, and offers certain newer additions of its own.

For the sake of simplicity, we shall take a look at the simple case of type inference in TypeaScript. If you declare something like this:

var c = 100;
var me = “awesome”;

TypeScript will automatically infer that the former variable holds a numerical value, whereas the latter is a string type.

TypeScript also supports classes with the optional type annotations integration:

class Person {
private name: string;
private age: number;
constructor(name: string, age: number) { = name;
this.age = age;
toString(): string {
return + " (" + this.age + ")";

Code Courtesy: Wikimedia Commons

The language comes with support for features proposed in the upcoming ECMAScript 6 standards.

Wish to learn more about TypeScript? You can master it using the specifications’ file here.

Note: Above link directs to downloadable DOC file.


So, is TypeScript worth it? In a scenario in which the internet is, to a good extent, powered by JavaScript, Microsoft has tried to augment JS and its features and couple them with a creation of its own in the form of TypeScript. The plan in itself is good, and though it has so far received a mixed reaction, it is pre-mature to declare it a success or failure straight away. I’m happy that the language is open source, and unlike others, it is not refusing to acknowledge that it comes from JavaScript.

What do you think of TypeScript? Will you be using it? Share your thoughts with us in the comments!

Related Links