I’m fairly vocal about my opinion of Microsoft products. They have never made a single that is better than the competition, except maybe C#, but only maybe.

IE vs Safari vs Opera vs Chrome vs Firefox: Chrome or Firefox win

Office vs iWork vs LibreOffice = iWork wins

Windows vs OS X vs Linux = Linux wins with OS X a close second

However, they have finally made a product that is I would use over the competition, and most developers I talk to agree.

What is TypeScript?

TypeScript is a strongly typed, class oriented language that compiles into JavaScript. Syntactically, it’s a lot like ActionScript 3, but doesn’t provide any libraries. Conceptually it’s a lot like CoffeeScript, which is it’s main competition.

TypeScript’s advantage over CoffeeScript is that it is a subset of JavaScript. Think about what C++ is to C and you will understand. It adds things to the language without taking anything away.

On the other hand, CoffeeScript has a completely different syntax to JavaScript. Furthermore, I am not a fan or white space sensitive languages. I’ve seen indentation errors screw up developers more than I have seen curly brace errors.

Back to TypeScript though.

Here is an example of TypeScript.

This TypeScript…

class SomeClass{

public someString:string = "";
public someNumber:number = 42;

}

…will become this JavaScript when compiled.

var SomeClass = (function () {
function SomeClass() {
this.someString = "";
this.someNumber = 42;
}
return SomeClass;
})();

Because it compiles to JavaScript, TypeScript can be used anywhere JavaScript an be used. That means browsers, Node.js, and Cordova applications can now be written in strongly typed, class oriented ways, which helps organize code a lot.

I’m sure I will be talking about TypeScript more in the future once I start using it in production, but for now I’m just going to experiment with it on personal projects.

Below is a TypeScript REPL for you to try out TypeScript. If you want an online IDE to try TypeScript out in try the official site. It has a great online IDE.