TypeScript 1.1

性能优化

1.1 版编译器大体比之前任何版本快 4 倍. 查看 这篇文章里令人印象深刻的对比.

更好的模块可见规则

TypeScript 现在仅在开启了 --declaration 标记时严格要求模块类型的可见性. 对于 Angular 的场景来说非常有用, 比如:

  1. module MyControllers {
  2. interface ZooScope extends ng.IScope {
  3. animals: Animal[];
  4. }
  5. export class ZooController {
  6. // 过去是错误的 (无法暴露 ZooScope), 而现在仅在需要生成 .d.ts 文件时报错
  7. constructor(public $scope: ZooScope) { }
  8. /* 更多代码 */
  9. }
  10. }

[1] 原文为 “A mixin class is a class declaration or expression that extends an expression of a type parameter type.”

[2] 原文为 “Null- and undefined-aware types”

[3] 原文为 “The changes also inline calls Object.getOwnPropertyDescriptor and Object.defineProperty in a backwards-compatible fashion that allows for a to clean up the emit for ES5 and later by removing various repetitive calls to the aforementioned Object methods.”

[4] 原文为 “While not strictly a language change…”