TypeScript 2.0 最终版发布了。它带来了一些新的功能,提高了开发人员的生产力,先进的TypeScript 校准和ECMAScrip的发展,为JavaScript库和工具提供了广泛的支持,并增强了语言服务,提供了跨工具的一流编辑体验。 值得关注的更新内容: 控制流分析类型 1 2 3 4 5 6 7 8 | function f(condition: boolean) {
let result: number;
if (condition) {
result = computeImportantStuff();
}
return result;
}
|
readonly 修饰符
1 2 3 4 5 6 7 8 9 10 11 | class Person {
readonly name: string;
constructor(name: string) {
if (name.length < 1) {
throw new Error( "Empty name!" );
}
this .name = name;
}
}
new Person( "Daniel" ).name = "Dan" ;
|
相关链接: 下载地址: 安装命令
1 | npm install -g typescript@2.0
|
|