TypeScript – first impressions are promising but where will it end up?

Earlier this week Microsoft announced TypeScript, an open source language that compiles down to plain old JavaScript. OK I can already guess what’s going through your head, you are thinking “is it like CoffeeScript?” or “is it like DART?!” Fortunately the answer to both questions is no!.

CoffeeScript doesn’t need improving and one DART language is more than enough! DART compiles down to JavaScript but it also targets the DART VM. TypeScript on the other hand is a superset of JavaScript, its not intended to replace JavaScript, rather it give you a more productive experience in writing JavaScript particularly on a large projects.

“TypeScript has a fighting chance of making it..”

I think TypeScript is in with a fighting chance of making it because of the tooling that it puts in developers hands. Microsoft builds excellent IDE’s and with TypeScript you now have all that intellisense goodness and static code analysis at your fingertips. Hardcore JavaScript developer are more than happy to work away in vim and lightweight text editors but there are plenty of mere mortal developers that will enjoy the TypeScript development experience.

Shipping the TypeScript compiler as a node package is a clever move. TypeScript can run wherever node.js can which covers most platforms of choice.

 Please keep the language spec clean and simple ! Less is  definitely more with TypeScript

The TypeScript language specification is currently nice and uncluttered but who knows where it will end up?. Anders Hejlsberg (lead architect of the C# language team ) is at the helm. When you compare C#1.0 and C#4.0 they are completely different beasts. In the case of TypeScript less is more in my opinion. It should be about giving developers just enough design time type checking and intellisense without completely stifling the dynamic nature of JavaScript.The road map for TypeScript includes support for generics – this scares me. Do you really need generic support in a dynamic language like JavaScript?

What’s nice about TypeScript

(1) Inheritance is nice and cleanly implemented

Below is a simple example of inheritance where specialCustomer extends the customer class and calls the base class constructor from its constructor.

class customer {
	id: number;
	name :string;

	constructor (name: string, id:number) {
		this.name = name;
		this.id = id;
	greet() {
		return "Hello, " + this.name;

class specialCustomer extends customer{
	loyaltyCardNumber :string;

	constructor(name:string,id:number,loyaltyCardNumber :string){
		this.loyaltyCardNumber = loyaltyCardNumber;

TypeScript does the heavy lifting adding the necessary prototyping and closures for you – this is very cool and definitely saves time!

var __extends = this.__extends || function (d, b) {
    function __() { this.constructor = d; }
    __.prototype = b.prototype;
    d.prototype = new __();
var customer = (function () {
    function customer(name, id) {
        this.name = name;
        this.id = id;
    customer.prototype.greet = function () {
        return "Hello, " + this.name;
    return customer;
var specialCustomer = (function (_super) {
    __extends(specialCustomer, _super);
    function specialCustomer(name, id, loyaltyCardNumber) {
        this.loyaltyCardNumber = loyaltyCardNumber;
        _super.call(this, name, id);
    return specialCustomer;

(2) Visibility Modifiers

The visibility modifier keywords like private are enforced by the TypeScript compiler but the generated JavaScript does not reflect this. A private property is implemented as a regular property but the compiler will enforce a developers intent with regard to visibility modifiers.

(3) External Type declaration files

Type declaration files (.t.ds file extension) define all the public interfaces that your JavaScript code exposes. Check out the node.js file that is published here. By creating an external type declaration file you get to interact with other existing libraries through TypeScript. Currently these files are hand crafted which sounds really tedious but I’m sure this will be automated in a future release.

(5)TypeScript  Playground

Similar to the google DART board, TypeScript has a nice web based shell where you can get your hands dirty without downloading anything. Check it out and have a play.


What not nice about TypeScript

(1) The  plug in for Visual Studio 2012 install as a C# template! Confusing eh? I sure found it hard to find !

(2) Slow feedback loop in Visual Studio.

You need to compile your project to view the generated JavaScript code. It would be nice if the there is a split panel view where you can see the generated JavaScript as you are coding , similar to the playground.

What’s Missing

  • Async/Await keywords would be a really nice feature. There are several  well known JavaScript implementations to borrow from.
  • An external type declaration file generator. A tool that can load up a JavaScript library and “decompile” it to a .t.ds file.
  • Better Visual Studio experience à la TypeScript Playground.

Overall I’m very excited about TypeScript. Microsoft is clearly getting very interested in embracing JavaScript in its many forms, their arsenal includes node.js support on azure, Win.JS, KnockOut.JS (Microsoft employee) and a JavaScript Hadoop offering. While TypeScript won’t be everyone’s cup of tea I’m sure it will appeal to a large enough portion of the development community to give it legs.

may the source be with you!



One thought on “TypeScript – first impressions are promising but where will it end up?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s