TypeScript - Microsoft's Replacement For JavaScript
Written by Mike James   
Monday, 01 October 2012

Microsoft has just announced a new programming language - TypeScript. It's targeted at replacing JavaScript by being more maintainable in large projects. Do we need yet another JavaScript replacement?

 


 

More information: Getting Started With TypeScript

 


 

Everyone seems to have a replacement for JavaScript - Google even has two. Now Microsoft has revealed that Anders Hejlsberg has been working on a replacement and it has released a preview of TypeScript.

TypeScriptlogo

TypeScript is open source - Apache 2.0 license -- and a superset of JavaScript. As you would expect from a Hejlsberg language it incorporates type checking, interfaces and lots of syntactic sugar. 

The good news is that it is compatible with JavaScript - you can simply load JavaScript code and run it. JavaScript programs are TypeScript programs. The TypeScript complier outputs JavaScript so compiling a JavaScript program is just a pass though operation.  To improve on JavaScript, TypeScript lets you include annotations that allow the compiler to understand what objects and functions support. The annotations are removed by the compiler, making it a zero overhead facility.

It also adds a full class construct to make it more like traditional object oriented languages. Not every JavaScript programmer will be pleased about the shift in emphasis, but the way it compiles to a JavaScript constructor is fairly transparent.

 

typescriptclassA

A class in TypeScript (above)- and what it compiles to (below)

typescriptclassB

 

You can see a video of Anders Hejlsberg explaining the pros of Typescript below:

 

 

Microsoft has a Visual Studio add-on to handle TypeScript projects complete with intellisense etc. In addition there are now syntax files for Sublime, Emacs and Vim.

 TypeScriptlogo

 

This announcement explains quite a few things. It explains why Hejlsberg made so many cutting comments about JavaScript at June's Lang.NEXT. It also suggests that the father of C# has found other things to interest him. Since Windows 8 was announced it has been clear that a shift of power within Microsoft has made C#, and the whole .NET system, look less attractive - you could say that the re-imagining of Windows brought the limelight back on C++. This is probably a good time for Heljsberg to focus on improvements to the most used language on the planet and make it fit for large applications.

It might make sense for Heljsberg, but it might make less sense for the rest of us. There are already enough alternatives to JavaScript and only time will tell if the appropriate response is a big yawn or something more excited. The one big edge that TypeScript has is the promise of improved tools. Visual Studio is a good IDE and it might be enough to make TypeScript attractive.

At this early stage it is difficult to see the development as good. It isn't particularly good for JavaScript developers who already have alternatives, and it isn't good for C# developers who now have confirmation that Anders Hejlsberg is looking elsewhere.

 


 

More Information: Getting Started With TypeScript

 


 

More Information

You can download TypeScript from CodePlex: http://typescript.codeplex.com/

If you want to try out an in-browser version visit: Playground

Sublime, Emacs and Vim support

Related Articles

Getting Started With TypeScript

JavaScript The Evil Parts - You Can't Maintain It

 

blog comments powered by Disqus

 

To be informed about new articles on I Programmer, install the I Programmer Toolbar, subscribe to the RSS feed, follow us on, Twitter, Facebook, Google+ or Linkedin,  or sign up for our weekly newsletter.

 

Banner


NFC For Man's Best Friend
01/04/2014

Barclalycard has unveiled plans for PayWag, a payment chip that is discretely embedded into a dog's collar to allow it make small purchases. Does it mean you can stay in bed while the dog collects, an [ ... ]



PredictionIO - The Easy Recommendation Engine
14/04/2014

One of the most common applications of AI or advanced stats, depending on how you look at it, is the recommendation engine. All too often the first impulse is to build your own - but it's tough and th [ ... ]


More News

 

 

 

 

 

 

Last Updated ( Wednesday, 03 October 2012 )
 
 

   
RSS feed of news items only
I Programmer News
Copyright © 2014 i-programmer.info. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.