-
新建一个文件夹
-
安装typeScript:
npm install -g typescript
-
打开终端:
tsc --init //会生成一个tsconfig.json文件
-
在tsconfig.json文件里面配置:
- 在vscode的配置:
-
打开工具栏:ctrl + shift + B(快捷键)
-
选择tsc监视 tsc: watch - tsconfig.json
-
Found 0 errors. Watching for file changes.
- 出现则配置成功,会自动生成js文件