什么是compiler?为什么需要compiler?
现在浏览器并不完全支持es6,所以需要compiler将es6转换成ES5的语言供浏览器解析
使用在线compiler进行开发:
http://www.typescriptlang.org/play/index.html

使用本地compiler:
1、安装:sudo npm install -g typescript
2、写一个.ts文件:

3、命令行执行:tsc Hello.ts

4、生成js:

5、还可以使用webstom自动编译:

网友评论