Alexander Beletsky's development blog

My profession is engineering

Looking at TypeScript

Four days ago my twitter has been nuked. The bomb has exploded after TypeScript site link has reach to top of Hacker News and people watched the video of Anders Hejlsberg who generally described the language features and showed some example. Everybody were talking about TypeScript.

For ones who missed the video (I can’t believe you did) I shortly describe - TypeScript in new open source project, by Microsoft. It’s leader Anders Hejlsberg is very famous developer (my bad, I always forget his name), creator of C# and one of the persons who most influenced .NET platform. TypeScript compiled down to JavaScript, but it introduce the types checking during compilation, so it could be called ‘static typed language’.

First of all, TypeScript is definitely not the first language, that complies to JavaScript. It’s not the first one that augments JavaScript with new statements like class, interface or module. So, what’s so interesting on it?

I’ve been using static type languages for about 10 years. I’ve very much got used to compiler error messages and truly believed that it helps to build applications. Meaning, the complier is first guard towards the ‘good’ code. To the code that could be called reliable, error free.

But situation much changed after I start programming JavaScript.

I feel myself quite productive with using of using JavaScript. Of cause, there are some best practice & patters are collected nowadays, we have better tools, faster engines and JavaScript has been so much adopted by community. But JavaScript is indeed, so powerful language. I really like the dynamic typing, that bit more forces to unit testing, making code changes more easy in the same time creating some very beautiful code structures.

I know that some people are saying, “we don’t need any static typing for JavaScript; please don’t change the language”. Such developers could be called “purists”. And they are absolutely right - if you feel confidence in something you do, you should not change the way you do it.

In another hand, I came to conclusion that it’s not dynamic types that makes me productive with JavaScript, but rather the experience I gathered with programming lately. It’s always only experience, that allows you to work faster, better quality and had fun of your job.

And it’s absolutely not about Static vs. Dynamic languages.

Static types are not useless, though. I think, in average it reduces the chances of bug introduction into the code. That’s at least what I’ve seen so far. And that’s why “purists” are running JSLint. Basically, Static Types should provide better application quality. This is of cause not completely true, since we know great software written in Python and poor systems written in C++.

It’ about the engineers who build that software.

In my opinion the TypeScript will grow. It would have it’s own army of fans, like CoffeeScript have or Ruby have. The code that TypeScript outputs is nice and clean, that make easy of debugging it. TypeScript is designed to be closer to ECMAScript6 (Harmony), so in near future the pure JavaScript would start to look like TypeScript.

TypeScript is interesting project and open minded guys will like one.