TypeScript Release Adds Generics
Highlights of the new features:
- Generics support brings this popular feature to TypeScript, allowing for better type checking and modern programming patterns.
- Overloading on constants
- Support for use of “export = “ to support the direct importation of classes
- TypeScript 0.9 – Redesigned to support future growth of the language. Improvements have been made to better support incremental compilation, scale-up to larger codebases (100k+ lines), and fixes over 160 errors reported on CodePlex.
An interesting roundtable discussion with members of the TypeScript team, including Anders Heljsberg, Steve Lucco, and Luke Hoban was recently posted by Channel 9. The conversation provided some additional insight into the new features of 0.9. Hoban observed that TypeScript’s support for generics provides benefits even if they are not used directly by a programmer. This is because TypeScript’s support for generics allows it to improve IntelliSense performance and assist with error checking.
Hejlsberg provided the following example during the discussion to demonstrate the changes from 0.8 to 0.9:
var a = [ “hello”, “world”, “….” ]
var n = a.map( s => s.length)
(where n is an array of numbers)
TypeScript 0.8: s. <- IntelliSense would show nothing
TypeScript 0.9: s. <- IntelliSense can show completions, including length
Craig Motlin Sep 01, 2014