How's TypeScript?

Created: 2016/04/13 22:23:25+0000

How's TypeScript? I had planned to complain about TypeScript because I couldn't generate the doc the way I wanted. Then I found the flag to fix it so I decieded to say something nice. Documentation generation matters.

Yes, TypeScript is a bit better than JavaScript. No I'm not going to change my website to use it any time soon but that is because I'm tired of reqritting my website.

I had implemented a simple JavaScript library and application to poll and parse a JSON resource. Then I asked myself why JavaScript. I had in the past tried out ClojureScript so I decided to give TypeScript a go.

I rewrote the JavaScript code progressively. Porting one file at a time until everything but the tests was TypeScript. Working this way I didn't find any type errors in my existing code. I did get type errors while I tried to figure out how to express the type signature I needed for something like an array of callbacks. What I mean is that the type annotations did not find a nest of hidden vipers in my code. My code was not more type-safe after porting to TypeScript than before.

That my code was not safer now is not a great surprise as it worked. I ran it and everything functioned as it should. No exceptions were thrown. I wasn't trying to call undefined, or access a number as an array. It made it very clear that type systems catch errors at compile time that would generate runtime errors.