In association with heise online

20 June 2013, 12:30

TypeScript 0.9 introduces support for generics

  • Twitter
  • Facebook
  • submit to slashdot
  • StumbleUpon
  • submit to reddit

TypeScript logo

Microsoft says that version 0.9 of TypeScript, available under the Apache licence, is the biggest update so far to the JavaScript superset. The company first introduced the programming language, a compatible JavaScript alternative, last autumn. Among the developers working on the project is Anders Hejlsberg, the creator of C#, Turbo Pascal and Delphi. Along with the obligatory bug fixes, version 0.9 includes several language updates.

Probably the most important update is the addition of generics, the feature most requested by TypeScript users, according to TypeScript program manager Jonathan Turner. Developers can use generics to introduce additional variables for types that are then switched out for concrete types when classes, interfaces or methods are used – this increases type safety when code is reused.

Type safety is one of the most important features of the language, which adds optional static typing and class-based object orientation to JavaScript. Unlike Google's plans for Dart, Microsoft does not see TypeScript as a replacement for JavaScript but rather as a way for developers to add extra features to the original language, similar to CoffeeScript. The company says that TypeScript can therefore be used to write large, scalable applications – an area that has traditionally not seen much use of JavaScript.

Other updates in TypeScript 0.9 include a finalised syntax for enumerated types (enums), method overloading, and syntax changes that will help the language work better when using JavaScript and TypeScript modules together. Some of the updates mean that breakage in older code written with previous TypeScript versions has to be expected; however, this is forgivable, considering the language hasn't even reached version 1.0 yet.

Microsoft has also reworked the compiler so that compiled results should now be closer to the language specification; performance when working with Microsoft's Visual Studio development environment also seems to have been improved. TypeScript 0.9 seems a bit slower than previous versions when working from the command line, but the language's developers plan to fix this issue in the next small update.

Other changes and updates can be found in Microsoft's release announcement. The source code for TypeScript 9.0 can be downloaded from the project's web site, which also includes installation instructions for installing the compiler with Node.js and NPM.

See also:



  • July's Community Calendar

The H Open

The H Security

The H Developer

The H Internet Toolkit