Microsoft's JavaScript Superset Now a First-Class Language in Visual Studio

 
 
By Darryl K. Taft  |  Posted 2014-02-25
 
 
 

Microsoft's JavaScript Superset Now a First-Class Language in Visual Studio


Microsoft has announced the release of Visual Studio 2013 Update 2 (2013.2) Community Technology Preview (CTP) 2 and Team Foundation Server 2013 Release Candidate (RC).

Visual Studio 2013.2 CTP 2 builds on the newly added capabilities from CTP 1 while also providing functionality to make development teams even more productive, Microsoft said. Team Foundation Server 2013 Update 2 RC not only builds on the newly added capabilities but also includes a go-live license for developers to start adopting the new features in their environments. The Visual Studio release is cumulative and contains everything already released in Update 2 CTP 1.

One of the highlights of Visual Studio 2013.2 CTP 2 is that it introduces TypeScript 1.0 RC. This is the first 1.0 release of the TypeScript language and tooling, bringing it closer towards the final release as part of Update 2. Starting with this release, TypeScript is now in-the-box with Visual Studio 2013. And TypeScript 1.0 RC also is being made available for Visual Studio 2012 customers as a standalone installer. More information about the new releases is available in blog posts here and here.

TypeScript is about large-scale application development in JavaScript, Anders Hejlsberg, a Microsoft Technical Fellow, creator of C# and leader of the TypeScript team, told eWEEK.

"JavaScript is tremendously popular these days and is sort of the only game in town when it comes to cross platform, but it also is a dynamically typed language that was never really intended for more than 100- or maybe 1000-line apps," he said. "And now people are regularly writing 100,000- or 1 million line apps in JavaScript. And those apps become tremendously hard to write and even harder to maintain once they get beyond a certain size – about tens of thousands of lines or so. It's hard because JavaScript lacks a lot of these large scale application structuring concepts like classes and modules and interfaces and also static typing is notably absent in JavaScript."

Moreover, what has powered the whole revolution in integrated development environments (IDEs) over the last 10 years or so has been those large-scale structuring concepts. In particular, it has been static typing that is the deep enabler of things like IntelliSense and statement completion, refactorings, 'go to definition,' and 'find all references,' Hejlsberg said.

"Those are things that are like air to programmers today," he said. "You take that away and programming becomes a very, very hard endeavor. So the thought process behind TypeScript was what could we do to add those missing concepts to JavaScript and how could we do it in a major way that doesn't compromise the true value of JavaScript – namely that it runs in any browser on any OS on any platform. That really is what TypeScript is; it's a superset of JavaScript that compiles to plain JavaScript. And the compiler is written in itself and therefore compiles to JavaScript and runs on any platform, even on your phone."

Microsoft's JavaScript Superset Now a First-Class Language in Visual Studio


Microsoft took a different approach with TypeScript. The entire project from inception has been open source and is hosted on CodePlex, Microsoft's open-source repository. Since its first public release in October 2012, Microsoft continuously released TypeScript updates in the open. They went through a series of compilers—first the 08 series and then moved on to the 09 series of compilers where they introduced generics in the type system, which further strengthens a developer's ability to describe and use APIs in a strongly typed manor. And now the team is at a point where they have worked enough on scalability, correctness and stability that they are announcing the 1.0 Release Candidate of TypeScript.

In a year and a half, the uptake on this project has exceeded even the TypeScript team's most optimistic expectations, Hejlsberg said. TypeScript has seen lots of internal usage now at Microsoft, but also a large amount of external usage and a very vibrant community, he said.

"Internally, some of the marquee projects include Visual Studio Online -- the 'Monaco' toolset in Visual Studio Online is all built in TypeScript and is a 300,000-line project," Hejlsberg said. "They started out coding just in plain JavaScript and were initially somewhat skeptical but they are total converts now. The Xbox music app in Windows 8.1 was written in TypeScript. The F12 tools in Internet Explorer 11 are written in TypeScript. We have lots of usage in Bing in a variety of their properties. We have usage in Microsoft Dynamics AX. Almost every division in Microsoft is using TypeScript in one way or another."

Speaking of  'Monaco,' which is the code name for a new service that enables a lightweight coding environment in the browser, Hejlsberg said he is amazed by it.

"I am amazed at what that team has built," he said. "It is such a high quality implementation of a complete IDE in JavaScript that I would have sworn it wasn't possible to build and yet they built it. It's a testament to the team's capability; I think it's a testament to TypeScript as a large-scale application development tool. And also a testament to the power of the JavaScript VMs that we have in our browsers today. It's amazing how powerful that execution platform has gotten."

Externally, there has also been a fair amount of uptake for the technology. For instance, portions of the Adobe Digital Publishing Suite for Windows 8 are written entirely in TypeScript.

"We've seen the community build TypeScript plug-ins for all the popular development tools out there, including Eclipse and JetBrains' ReSharper and WebStorm," Hejlsberg said. "You can find out there in the wild, CoffeeScript to TypeScript converters. We've seen a company called SitePen that develops the Dojo JavaScript framework, they are very pro TypeScript and have an excellent TypeScript tutorial and are investigating uses of TypeScript in Dojo. Google made the TypeScript compiler part of the Octane 2.0 benchmark. So they recognized it's important enough that VMs should be benchmarked against how well our compiler runs on them. And we've seen a number of HTML5/JavaScript game frameworks or 3-D frameworks pick up JavaScript. I think the reason there is that TypeScript is a very natural evolution from ActionScript. So if you've been programming in Flash and you're looking to move to HTML5, TypeScript is an excellent path. Because if you are accustomed to having classes and type annotations, which are present in ActionScript, then TypeScript provides you an even richer version of that."

Microsoft's JavaScript Superset Now a First-Class Language in Visual Studio


And because TypeScript is a superset of JavaScript you can use it with all the existing frameworks out there like jQuery or Node.js or Backbone.js or Knockout.js or AngularJS or whatever, Hejlsberg said. "You can use them straight up or if you write a type definition file in TypeScript, then you get an even better tooling experience if you describe the static typing that's in the particular framework," he said. "And organically in the community, a GitHub site called Definitely Typed sprung up and we now have more than 200 JavaScript frameworks covered with type definitions for TypeScript. So pretty much any JavaScript framework you pick you can find a TypeScript type definition file on Definitely Typed. And there are more than 300 individual contributors and more than 4,000 commits in the repository. I think that's a fantastic testament to the interest in TypeScript as a tool."

Having TypeScript in the box means when you install Visual Studio you get TypeScript automatically. It also means Microsoft is committing to TypeScript as a first-class supported language in Visual Studio. But this does not change the fact that TypeScript is an open-source project and will be available for anyone else to download and use with their development tool of choice on their platform of choice, Hejlsberg noted.

Meanwhile, other new features in Visual Studio 2013.2 CTP 2 include enhancements to ASP.NET. It integrates the latest ASP.NET MVC, Web API and Web Page releases from the January release. It also features a new editor for Syntactically Awesome Style Sheets (SAAS) files, a new JSON project item and editor to help developers create or edit JSON files in Web projects, integration for new Web Projects that streamlines the use of Windows Azure as a Website host from the start, and various other changes and bug fixes. In addition, the Entity Framework 6.1 Beta 1 is now included with this release with various improvements.

Improvement for Windows Azure developers include that the sign-in into Visual Studio will now integrate a streamlined Azure activation workflow for MSDN subscribers, making it easier to take advantage of their Azure benefits. When signing in, users who have not yet activated their subscription benefits will be offered an opportunity to do so, giving them another place to be reminded of the MSDN plus Azure value. Also, developers can now use Windows Azure Notification Hubs to send test notification messages to Windows Store, Windows Phone, iOS, and Android devices and check the outcome in real-time.

There are enhancements for C++ developers such as that they can now specify to compile their programs to target latest-generation processors that support AVX2 instruction sets. There is a new Incoming Changes indicator in CodeLens that enables users to see incoming changes from other branches that could impact their code. And developers can now use Code Maps to visualize IntelliTrace performance events to help them identify the path to each of the slowest nodes. Also Nuget 2.8 is included in this release.

Team Foundation Server 2013.2 RC includes a go-live license for TFS components. This release includes everything that shipped in CTP1 plus various improvements for Git and Java Builds for Git repositories for on-premises TFS. Visual Studio Online gains the support of Java apps in hosted Git repositories and adds Java technologies to the hosted build image. And Team Explorer Everywhere (TEE), Update 1 gains Git and Java Build support in Visual Studio Online or TFS 2013 Update 2 RC.

Rocket Fuel