{
"taskName": "test build",
"command": "tsc --out ./js/test.js ./ts/test.ts",
"type": "shell",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [
"$lessCompile"
]
}
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"preLaunchTask":"test build", //the task name in task.json
"program": "${workspaceRoot}/js/test.js",
"outFiles": [
"${workspaceRoot}/out/**/*.js"
]
}
~~~
mkdir projectname
cd projectname
npm init // or cordova create for cordova project!!
tsc --init
npm install --save @types/lodash // for ts type definition
npm install --save packagename //install package
npm install --save-dev @types/packagename //install type define of the package
vi tsconfig.json
update typeRoots, add the path ["./node_modules/@types"]
~~~
https://hackmd.io/s/rkITEOYX
https://github.com/kkbruce/TypeScript/blob/master/doc/zh-tw/Handbook.md
https://zhongsp.gitbooks.io/typescript-handbook/content/doc/handbook/Basic%20Types.html