JavaScript’s place within the development sphere continues to grow and evolve. This was demonstrated throughout the recent Microsoft TechEd conference where JavaScript solutions for Windows 8 and web development were covered, along with the JavaScript superset TypeScript, which follows in the footsteps of CoffeeScript and other similar offerings. Here’s a look at this new foray called TypeScript; it just might bring JavaScript to the mainstream.

A Microsoft version of JavaScript?

JavaScript is a Web standard, so you may be wondering why Microsoft is promoting TypeScript (can you say JScript?). TypeScript does not rewrite JavaScript or offer an alternative — it offers a way to more easily develop JavaScript code.

JavaScript development is often seen as sort of the Wild West. The selling point for TypeScript is manageability; that is, TypeScript provides compiler services and type checking, and Visual Studio integration is available. While I am not worried about Microsoft trying to highjack JavaScript, TypeScript is definitely an approach to JavaScript development that targets developers who are using Microsoft technologies.

How to get and use TypeScript

TypeScript has been available since October 2012, but it has gained momentum lately as new features have been added. TypeScript is open source available from its website, and the source code is available via CodePlex.

The basic way to utilize TypeScript is via npm (Node.js package manager). This includes a command-line compiler that processes TypeScript source files (normally using .ts file extension) and generates standard JavaScript. The basic syntax for the command-line compiler is:

tsc.exe <input file>

The result is a JavaScript output file. Like most command-line tools, it offers a number of options (switches) that are described in more detail in its documentation.

The TypeScript site provides an online playground for working with the language on-the-fly, so visit the play area to get a feel for what it offers. While on the site, the samples section features a number of excellent examples of how it may be used in real-world scenarios.

The other way to utilize TypeScript is via its Visual Studio 2012 plug-in. This allows you to develop TypeScript (and subsequently JavaScript) within the standard Microsoft development environment. (There are  a number of articles on the web that provide information on utilizing TypeScript within Visual Studio 2010.)

What TypeScript offers

A lot of the TypeScript discussions at TechEd 2013 that I heard focused on developing Windows Store applications. With that said, the latest TypeScript version (0.9) brings generics to the language, which offers a vehicle to promote code reuse. Other features include method overloading, interfaces,  internal/external modules (think namespaces) and much more. This blog post from the Microsoft team provides more information on the features of TypeScript 0.9.

When examining something new like TypeScript or CoffeeScript in the past (well, at least, new to me), it becomes a personal choice on whether the new tools and/or technology are worth the effort — that is, will they help me with the daily grind of application development? I am still undecided on whether TypeScript will help me, but I can see its usefulness for large-scale development efforts involving JavaScript.

Its usefulness lies in its tight integration with the current iteration of Visual Studio (and I assume future versions). All of the TypeScript documentation and content seems to highlight simplifying tool integration as a key goal of the TypeScript initiative. While Microsoft brought Visual Studio integration to the fold, others can easily integrate with their tools as well; it remains to be seen whether this will happen.

The inclusion with Visual Studio 2012 brings a powerful feature to JavaScript development: debugging capabilities. This has always been a sore spot with JavaScript developers, as they often lean heavily on alert statements or use JavaScript debuggers like Firebug. As previously stated, the tight integration with Microsoft’s IDE means TypeScript is likely to remain a Microsoft tool/language, especially with all of the examples of using it in Microsoft Store applications.

Withholding judgment

I dismissed TypeScript when I first learned about it, but I became more intrigued with TypeScript after hearing it talked about at TechEd 2013. While the concept is interesting, I am still not sure it will have a place in my toolbox; the main reasons why are I have no current plans for Microsoft Store-based projects or any large-scale enterprise applications using JavaScript. However, like other development technologies, I will give it a more thorough test drive to determine whether I will use it on future projects.

Microsoft is promising the next version of TypeScript (1.0) later this year, so stay tuned.

Keep your engineering skills up to date by signing up for TechRepublic’s free Software Engineer newsletter, delivered each Tuesday.