November 4, 2016

Impressions on: Typescript

Typescript is a compile-to-javascript language developed by Microsoft. Its goal is to be, in essence, a statically-typed Javascript. In fact, Typescript is a superset of Javascript, which makes porting pretty easy.

Major language features

My Impressions

I just dove into Typescript after hearing a lot about it from various people over the last while. I was expecting a stodgy, Javaesque language, but although you could just use Typescript as such, you can also do so much more.

The Good

The type system is more advanced than I expected. Support for things like generics is complete and works well, and but there are also intersection and union types, guards, and the very-handy string literal type.

Gradual typing and type inference is what makes TypeScript truely nice to use. The interface between typed and untyped code is far, far less rocky than I expected. You can throw in a type annotation almost anywhere you think it might come up, and the compiler will start warning you about issues. Having type annotations at hot spots only really feels like the best of both worlds in Typescript.

The Bad

There’s not much not to recommend about TypeScript. If I had to pick something, it would be just the fact that it’s a compile-to-javascript language, meaning that, although it comes with it’s own compiler, in all likelihood you’ll end up having to get hooked into one of the many Javascript build tools to get started. Then again, this very well could be a feature for you, if you’re using one anyhow; support seems to be broad.

The Great

Did I mention type inference already?

Besides that, Typescript’s tooling is probably the one of the most impressive I’ve seen in the world of Javascript. The ts_server architecture makes it possible for any editor support advanced language features. I use a Vim plugin called Tsuquyomi that offers completion and error highlighting with syntastic on file save – who needs an IDE? Of course, I could be using Visual Studio, which does have quite the fanbase, so that might be worth pursuing too.

I would definitely recommend that you check out Typescript if you would otherwise be using Javascript. It will improve your life immensely.