1.1 版編譯器通常比以往任何版本都要快上約 4 倍。你可以查看這篇博文,里面有一些令人印象深刻的性能數(shù)據(jù)圖表。
現(xiàn)在,TypeScript 僅在提供了 declaration
標(biāo)志的情況下,才會嚴(yán)格強(qiáng)制執(zhí)行模塊中類型的可見性。例如,在 Angular 的場景中,這一改動就顯得非常實(shí)用:
module MyControllers {
interface ZooScope extends ng.IScope {
animals: Animal[];
}
export class ZooController {
// 以前這會是一個錯誤(無法暴露 ZooScope),但現(xiàn)在只有在嘗試生成 .d.ts 文件時(shí)才會報(bào)錯
constructor(public $scope: ZooScope) {}
/* 更多代碼 */
}
}
更多建議: