Call 864.421.9247 Visit ProActive Technology

TypeScript: Continuity For JavaScript


Back in October 2012, Microsoft launched a new language called TypeScript, a new compile-to-JavaScript language. My initial reaction when I saw the announcement was “not another replacement for JavaScript. Don’t we already have enough JavaScript wannabe’s, like CoffeeScript and Google’s Dart?” But as I examine TypeScript there are elements that I really like about the language.

Borrowing the short description from the TypeScript project:

TypeScript is a language for application-scale JavaScript. TypeScript adds optional types, classes, and modules to JavaScript. TypeScript supports tools for large-scale JavaScript applications for any browser, for any host, on any OS. TypeScript compiles to readable, standards-based JavaScript.

Javascript Is TypeScript

Ultimately TypeScript is a superset of JavaScript, not a replacement for JavaScript like Dart. Dart lovers, I know that Dart will compile to JavaScript, but that’s not the original goal. TypeScript is similar to CoffeeScript in that the language is designed to be compiled into JavaScript. But unlike CoffeeScript, JavaScript is TypeScript. You can take any JavaScript file and rename it to a TypeScript file (*.ts) and TypeScript will compile it back out as JavaScript. For experienced JavaScript developers the learning curve is much less than that of CoffeeScript which was inspired by Ruby and Python. The syntax of CoffeeScript is much harder for me to remember because I have not done a lot of Ruby or Python development. I’m sure that Ruby developers find CoffeeScript perfectly natural, but I just never have felt at home using CofeeScript.

New features available in TypeScript are not all just some additional sugary syntax. The TypeScript language is attempting to follow the ECMAScript Harmony (6th Edition) spec for most of these new language constructions. Although the standard is not complete, Microsoft has said that it aims to align TypeScript’s features with the proposed standard. This gives me some assurances that TypeScript will succeed because it is following the Harmony specification that future web browsers will certainly support.

Better Tooling for JavaScript

Web development really doesn’t need another compile to JavaScript language; for a complete mind-boggling list of available tools and languages check out altJS. But what JavaScript needs now more than ever is a better way to build and manage enterprise scale JavaScript applications. JavaScript is showing up in places that you would never have imagined five years ago. Writing a Windows 8 application? Use JavaScript. Want to write a server side application? Use JavaScript. Want to write an Office 2013 application? Yep, JavaScript. Until recently, the only time you would use JavaScript was as an event handler on a web page. While handling browser events is still the main application of JavaScript, JavaScript is going places fast. Unfortunately, the tooling for writing web page event handlers is inferior for writing an enterprise scale JavaScript application. TypeScript aims to solve this by including static typing, modules, classes, and interfaces to the lexicon of JavaScript developers. By adding a little bit of structure to JavaScript, the TypeScript team has enabled editors and IDEs to provide more description and intellisense to the developer:


And this editor capability is not limited to Microsoft Product. Jetbrains has already included TypeScript support for WebStorm 6.


Douglas Crockford, one of a handful of JavaScript gurus, has said “Microsoft’s TypeScript may be the best of the many JavaScript front ends.” But at the moment all we really have is an early experimental release of TypeScript, giving us a preview of things to come. When writing TypeScript code, it seems very familiar, unlike Dart and to some extent CoffeeScript. I wouldn’t bet my entire project on TypeScript’s future right now, but, you can certainly use TypeScript to manage and generate your JavaScript code today. And if TypeScript goes away, you still have the compiled JavaScript files that can be used in any project.

I wish I had more space to show all the features the language provides in one post. If you want to follow more of my observations with TypeScript, I have started a series over on my personal site. You can also read the sites below for more information on the language.

Additional Resources:

TypeScript Home

TypeScript Language Specification

TypeScript Project Hosting

TypeScript Blog

This entry was posted in General, Tech Tips and tagged , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *


You may use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>