Running with Code Like with scissors, only more dangerous


Announcing TypeScript

Posted by Rob Paveza

I'm very excited to announce that my team at Microsoft has released TypeScript, a new language for application-scale JavaScript development. TypeScript cross-compiles to JavaScript, and is fully compatible with existing JavaScript code. That means that your existing JavaScript can go directly into TypeScript, unchanged, and is immediately usable.

You can start by adding type annotations to your JavaScript, which allows your tools to give you compilation warnings and errors when you're doing something that appears to be incorrect.

The next step beyond annotating your code is that TypeScript exposes classes and modules. Anders discusses in his talk (video on the TypeScript homepage) that the design of TypeScript classes and modules was heavily influenced by the current design of ES6 classes and modules, so it should continue to be familiar as the ECMAScript standard evolves.

Lambdas (thick arrow syntax) preserve a reference to 'this', helping to address one of the most common errors in JavaScript programming. Class extensibility works like you expect, including super-constructor logic, which is another one of those areas of JavaScript programming that is hard to just get right.

Oh - and did I mention that it's completely open-source and available for Node?

Check it out! And keep an eye on my blog - I'll be talking about it as things evolve (and once I add TypeScript support to SyntaxHighlighter Evolved).

And one other editorial note - I recently used TypeScript to port a C#-based low-level graphics class I wrote that decodes a raw image stream into pixels into JavaScript + Canvas. It went off beautifully. Check it out - I think you'll be impressed how easy it is to work with! And in the meantime, check out Soma's blog and the Channel 9 video.