TypeScript 2.0 最终版发布了。它带来了一些新的功能,提高了开发人员的生产力,先进的TypeScript 校准和ECMAScrip的发展,为JavaScript库和工具提供了广泛的支持,并增强了语言服务,提供了跨工具的一流编辑体验。
值得关注的更新内容:
控制流分析类型[code]function f(condition: boolean) {
let result: number;
if (condition) {
result = computeImportantStuff();
}
// Whoops! 'result' might never have been initialized!
return result;
}[/code]readonly 修饰符[code]class Person {
readonly name: string;
constructor(name: string) {
if (name.length < 1) {
throw new Error("Empty name!");
}
this.name = name;
}
}
// Error! 'name' is read-only.
new Person("Daniel").name = "Dan";[/code]有关发行说明和链接到各种平台的安装,请查看发行公布
有关新特性方面的内容,请查看What's new in TypeScript 2.0
Breaking changes in TypeScript 2.0 查看重大更改内容
fixed issues query for TypeScript 2.0, TypeScript 2.0.2和TypeScript 2.0.3,查看完整的问题修改列表
安装命令
npm install -g typescript@2.0
软件详情:https://blogs.msdn.microsoft.com/typescript/2016/09/22/announcing-typescript-2-0/
下载地址:https://www.npmjs.com/package/typescript
来自:开源中国社区

