Blog Home RSS Kelvin Jackson

TypeScript Makes So Many Things Easier


TypeScript really does make so many things easier. It's not just a matter of catching bugs at compile time — which you can do — but also of still having the underlying freedom of JavaScript underneath, which lets you e.g. use the short circuiting operators to check for a null or undefined value, or call all of the JS functions you're already familiar with, without having to learn an entirely new API. But with typechecking when you need it.

As I know JavaScript pretty well at this point, getting my head around TypeScript has been pretty straightforward. The syntax for indicating types is pretty straightforward, and you can define interfaces that will be compatible with any arbitrary object that has the correct fields with the correct types, removing the need to worry about creating sensible constructors or remembering a class name when you just need to bundle several bits of data together in a logical fashion.

There are perhaps a couple of things I would change — I've found the syntax for generics tricky when I've tried to do a couple of things that don't come up super often — but it's definitely a marked improvement on vanilla JavaScript. I am now wishing I had taken this leap a bit earlier, so that I wouldn't have so many earlier projects to think about starting to port over!