Introduction to TypeScript
With that in mind, Anders Hejlsberg (creator of C# and the Roslyn project) who I’m certainly an admirer of had a fantastic session at Build 2012 detailing TypeScript’s features and use cases. You can view that session here.
While using the web site’s “Play” area is one option for code generation, since I use Visual Studio (VS) as my main development tool the TypeScript editor plug-in provides that same rich experience that I get from the web site but in my normal environment. I would like to have some project templates similar to say MVC as well as auto-compilation of “.ts” files but as I understand it that is coming. If you’re not using VS no need to fret as there are plug-in’s available for other editors.
I think one of the more noteworthy items of TypeScript is its use of declaration files (e.g. “<apiName>.d.ts”). This, as Anders puts it is the “stuff you have to remember when you hit ‘dot’ ” when you don’t have IntelliSense. The beauty here is that since these files are generated from metadata all the existing libraries (i.e. DOM, WinRT, WinJS, Node.js, jQuery, etc.) will work without modifying them. A simple reference statement is all that is needed.
Now I’ve had quite a few discussions about whether or not TypeScript is warranted when there are similar offerings (e.g. CoffeeScript, Dart, etc.). Some of the arguments on why TypeScript was even conceived are compelling although I tend to favor a “more options are better” philosophy. Then again not having any standardization is the devils playground but the odds of having Microsoft, Apple and Google collaborate on one implementation seems slim to none. Is it possible? Sure. Will it happen? Probably not.