Microsoft TypeScript graduates to Visual Studio

TypeScript offers a way to organize JavaScript code for large programming projects

TypeScript, a superset of the JavaScript programming language developed by Microsoft for creating complex applications, is now a full-fledged member of the company's flagship Visual Studio integrated development environment (IDE).

Tuesday's release of Visual Studio 2013 Update 2 includes TypeScript as a built-in programming language for the IDE. The company has also posted the first release candidate of what will be the production-ready version of the language, TypeScript 1.0.

"Increasingly we are seeing people use JavaScript to write large applications," said Anders Hejlsberg, Microsoft chief architect for Microsoft's C# language who also helped create TypeScript.

JavaScript, Hejlsberg noted, was intended for writing smaller programs. It does less well with larger software projects -- involving hundreds of thousands of lines of code, or even a million lines of code.

"It gets very unwieldy to maintain a code base," of a large JavaScript program, Hejlsberg said. "You can't safely refactor anything and there is no large-scale structuring concepts like classes or modules."

TypeScript is very similar to JavaScript but also incorporates traditional programming language constructs such as static typing and object classes, which set the stage for advanced IDE tooling and better organization of code.

Introduced in 2012, TypeScript is not an entirely new language. It is a superset of the ECMAScript, a specification for a scripting language maintained by the Ecma International standards body. The widely used JavaScript is based on ECMAScript.

Unlike JavaScript code, however, TypeScript program code must go through a compiler--one is available as open source from Microsoft. The output is formatted as JavaScript, and that code can run on any browser, and be incorporated into any JavaScript framework or server-side technology, such as node.js.

By compiling the code, TypeScript can offer many features typically associated with more traditional programming languages, such as Java and C++.

TypeScript offers static typing, which requires developers to define the data type of a variable before using that variable. It also features generics, which allows methods to be applied on different data types.

TypeScript also brings formal class-based object oriented programming concepts to JavaScript, borrowing new class definitions from ECMAScript 6, which Ecma is due to finalize later this year. Although a programmer can create objects in JavaScript, the language offers no way of creating classes.

Incorporating static typing and classes allows the IDE to provide more support for developers, though the use of tools such as Visual Studio's IntelliSense code completion tool, Hejlsberg said. TypeScript plug-ins are also available for other IDEs, such as Eclipse and JetBrains WebStorm.

One early user of TypeScript has been Adobe. Adobe needed to create a digital publishing viewer for Windows 8. The current Windows development environment offers two ways of building applications, by using either Microsoft's XAML (Extensible Application Markup Language) and C#, or with a combination of the HTML, CSS (Cascading Style Sheets) and JavaScript Web technologies.

"The engineering team had a background in JavaScript," said Neil Enns, a senior product manager for digital publishing at Adobe. They also knew, however, that writing a large program in JavaScript could be problematic. There are a number of tools to help in large-scale JavaScript development, such as CoffeeScript and Falcon.js, but Adobe preferred TypeScript because it could be run from within Visual Studio.

Microsoft has also been using the language in-house for projects such as Monaco, a Web-based version of Visual Studio under development.

"It was pretty clear that even though TypeScript was still early in its development, it was something that could give us good benefits," Enns said.


Join the Computerworld newsletter!

Error: Please check your email address.

Tags Development toolsapplication developmentLanguages and standardsMicrosoftsoftware

More about Adobe SystemsEclipseIDGMicrosoft

Show Comments