Note, this post refers to TypeScript 0.8.3, not the newly released version 0.9.0, described here.
So, whats the prehistoric story?
In the time before time, our webapp was a fairly complex beast implemented in CoffeeScript and AngularJS. It was supported with a Node/Coffee/Express backend. CoffeeScript is a beautiful seductress who constantly tempts with her concise, Ruby and Python inspired, almost Haskell-level beautiful syntax and promises of untold powers.
However, much like Melisandre, these promises come at a cost. We found ourselves taking short cuts and adding all sorts of state objects to tactically win the battle before us. What began to happen, especially on the client side, was that this quickly became unmaintainable. Even with our small team, there were fields that no one was quite sure were needed but no one had the courage to remove. Adding new features became a delicate dance on a pit of coals.
And the redemption?
I had been following TypeScript closely but never felt it was quite ready for me to take the plunge. When I discussed it with our contacts at Microsoft the message was pretty clear: "absolutely not!"
Tools of the the Trade
Boris Yankov's DefinitelyTyped library (https://github.com/borisyankov/DefinitelyTyped) was critical. It provides TypeScript type definitions for many popular JS frameworks. Without these, we'd basically be losing all the static typing deliciousness anytime we called a framework function (roughly every other line of code).
We started with just using TypeScript compiler in watch mode `tsc -w`, concatenating all our .ts files into a single .js file which we added to the repo. Including compiled assets in the repo still kind of bothers me but it did greatly simplify deployment at first.
Eventually we grew out of this and put together a simple Gruntfile which compiled our .less and .ts assets etc etc and that solution seems to be scalable.
Since none of us are on Windows we were using Vim as our editor which meant losing out on the apparently great TypeScript autocompletion in Visual Studio. Also, the Vim autoindent is messed up for TypeScript and will randomly give lines an extra 10 or levels of indent. Its not a deal breaker but is a little annoying.
YMMV, but for us, TypeScript's
small number of warts are far outweighed by yielding even a partial
solution to the big, fat, enormous, giant, wart of dynamic typing.
edit: Someone on Reddit pointed me to https://github.com/clausreinke/typescript-tools Looks like there might be autocompletion in vim aftter all!