Musings on Microsoft's TypeScript for JavaScript Development

Michael K. Campbell describes his feelings on Microsoft's TypeScript programming language for JavaScript development.

Michael K. Campbell

October 4, 2012

4 Min Read
hands on black keyboard virtual tiles floating above hands

Microsoft recently announced the addition of a new programming language, TypeScript, which is what the company is calling a superset of JavaScript. I've poked around with TypeScript a tiny bit since Somasegar's announcement. You can also see what contributing columnist Don Kiely's experience with TypeScript in his article, "Is Microsoft's TypeScript Programming Language Worth the Fuss?" Although I like what I see, I can't help but think about what the language might portend based on previous things that we've seen from Microsoft.

Anders Hejlsberg, C#, the .NET Framework, and TypeScript

The last time Anders Hejlsberg wrote a language at Microsoft, it turned out to be a big deal in the sense that we got the C# programming language. This introduction of C# in turn was intricately tied to the .NET Framework, which is a gigantic mountain of code that has served Microsoft as a solid development platform for over a decade.

When Microsoft initially announced C# in 2000, many developers that I worked with wondered why they should use another C-style language. Developers thought that C++ was powerful enough in its own right, and C# looked like Microsoft's Java knockoff. I can't help but see some similar parallels between the state of C++ in those days and JavaScript today—especially given some of TypeScript's goals that help JavaScript development to scale.

JavaScript Has Matured

JavaScript has matured a lot in the past three to five years from my perspective. In truth, I believe this maturation is due to the fact that my perception of the language has changed—thanks, in large part, to jQuery. Before jQuery's introduction into the development scene, I used to write code with JavaScript, but the language was something that I hated due to its compatibility problems that went hand in hand with using JavaScript across different platforms or browsers. However, because jQuery solved most of these problems through some awesome abstractions (which says nothing about making JavaScript coding fun through the introduction of its addictive CSS-like selectors and heavily promoting the use of closures), my own appreciation for JavaScript has grown.

In addition, JavaScript keeps getting faster and faster and is more heavily leveraged in development circles to the point where it can even be a full-blown hosting platform. It's apparent that JavaScript actually is a real language and not a toy language, which I thought it was for so many years.

Even though I consider JavaScript a full-blown programming language, there are still some things that I hate about working with the language, such as type safety. Although unit testing could help protect me from some of the ugliness that I've run into when working with JavaScript duck typing, I'm being honest when I say that I don't unit test my JavaScript code because I don't use it enough to hit a point where unit testing would make sense. However, if I wrote a full-blown project in JavaScript, then I would unit test my code. But I'm not sure that unit tests would protect me from type-safety problems—as one of the big problems with duck-typed languages is that type-safety problems always seem to bite you in situations that you don't think about or occur only "in the wild"—meaning that it's very hard to account for all situations or conditions in which conversion problems might engender bugs.

Accordingly, I think it's fair to say that Anders has my attention, given that one of the big benefits that TypeScript offers is additional annotations that enable type safety.

Is TypeScript the Way of the Future?

As I watch TypeScript introduce itself to the developer community with what looks to be some great tooling and some powerful potential in terms of how beneficial it can be to JavaScript through means of being both an abstraction and a superset of existing functionality, I can't help but think there's a bright future in store for TypeScript. I'm particularly excited by TypeScript's future when I think about how web development trends are moving increasingly toward architectures that heavily leverage JavaScript for dynamic in-page rendering against API-enabled back-end web servers such as Microsoft's ASP.NET Web API framework.
I also seem to remember something big about JavaScript becoming a very core component in creating Windows 8 applications. Stated differently, the last time that Anders got involved in a language, his developments had a pretty far-reaching impact and influence—so I just can't help but wonder what TypeScript's significance will be now that JavaScript is becoming more and more important both in the web and desktop development worlds.

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like