为了用Angular2先看了看typescript,
用的Visual Studio Code调试, 对ts支持挺好
Visual Studio Code配置
创建个vsc的task.vscode\tasks.json, 就省得每次Ctrl+Shift+B手动编译了
(后来发现tsc –watch其实也挺方便)123456789101112131415{ // See https://go.microsoft.com/fwlink/?LinkId=733558 // for the documentation about the tasks.json format "version": "0.1.0", "command": "tsc", "isShellCommand": true, "args": [ "-w", "-p", "." ], "showOutput": "silent", "isWatching": true, //监控代码变化,自动编译 "problemMatcher": "$tsc-watch"}
tsconfig.json12345678{ "compilerOptions": { "noImplicitAny": true, "sourceMap": true, "removeComments": false, "preserveConstEnums": true }}
typescript语法
声明变量类型
|
|
方法声明
|
|
类
|
|
接口
|
|
ES6的几个语法
|
|