Is TypeScript taking hold?

by DotNetNerd 7. April 2015 13:08

Fantastic times! I just got back from a week off around easter, summer is almost here and I was awarded Microsoft MVP for ASP.NET/IIS for the first time. So all I that is missing is getting some blogging done.

At the moment I am really enjoying TypeScript, and I am feeling really good abouts future with the recent collaboration between the TypeScript and AnguarJS teams. I still argue that in most cases where you want your solution to live long, you should avoid the SPA frameworks. However I concede that they are popular, so it is a good step for TypeScript, which I think will help the adoption. I also think it will be good for Angular 2.0, to avoid introducing their own new language, and instead get the benefits of the good work done on TypeScript itself as well as tooling.

Personally I have also been using TypeScript a lot more lately, where I have been upgrading an existing codebase and written new modules with it as well. I have been really happy with the rewrite, becuse TypeScript helped uncover some subtle bugs, even in parts of the codebase that I thought was more solid than it turned out to be. On top of that the code is much more readable, and I get the security of typechecking. To get all this goodness all I did was:

  • Convert the use of revealing module pattern into classes.
  • Write constructors that communicate the intent of the class well.
  • Use interfaces for complex arguments, mostly in the form of options passed in to a class.
  • Get rid of “that” by using arrow functions.
  • Introduce conventions for method names in modules like: bindEvents, load and dispose.
  • Add a handful of TypeScript definition files for the libraries used in the project.

In other words, I didn’t get fancy about it, but simply got rid of brittle and complicated constructs along with introducing typechecking at the entrypoints to my classes and functions. As a result I feel much better about this otherwise dated codebase. So I am thinking that TypeScript is starting to take hold for real now. So if you have a javascript codebase, that is hard to maintain, maybe it is time to give TypeScript a go? 

Who am I?

My name is Christian Holm Diget, and I work as an independent consultant, in Denmark, where I write code, give advice on architecture and help with training. On the side I get to do a bit of speaking and help with miscellaneous community events.

Some of my primary focus areas are code quality, programming languages and using new technologies to provide value.

Microsoft Certified Professional Developer

Microsoft Most Valuable Professional

Month List