$ npm install -g typescript
$ mkdir blog
$ cd blog
$ tsc --init
$ touch main.ts
在 tsconfig.json 找到以下代码,取消注释。
"sourceMap": true,
$ tsc -w
{
// Use IntelliSense to learn about possible Node.js debug attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceRoot}/main.ts",
"outFiles": [
"${workspaceRoot}/*.js"
]
}
]
}