您好,欢迎访问一九零五行业门户网

VSCode中配置TypeScript自动编译

相关推荐:《vscode教程》
安装typescript编译器visual studio code包含typescript语言支持,但不包括typescript编译器tsc。您需要在全局或工作区中安装typescript编译器,以将typescript源代码转换为javascript(tsc helloworld.ts)。
安装typescript的最简单方法是通过npm,即node.js包管理器,-g表示全局安装。
安装npm install -g typescript
检查版本-安装成功会输出版本信息tsc --version
xm@xm-vostro-3670:~/project$ tsc --versionversion 3.3.3333
新建helloworld文件夹和hello_world.ts文件mkdir helloworld
const text:string = 'hello world';console.log(text);
新建tsconfig.json{  compileroptions: {      target: es5,      module: commonjs,      outdir: out,      sourcemap: true  }}
新增任务tenimal->run task
选择tsc:build-tsconfig.json
配置完成按下f5发现目录下多了一个out文件夹配置的是outdir: out,debug console输出hello world。
修改text保存按下f5
更多编程相关知识,请访问:编程视频!!
以上就是vscode中配置typescript自动编译的详细内容。
其它类似信息

推荐信息