您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

VSCode中配置TypeScript自动编译

2026/1/15 6:25:56发布34次查看
相关推荐:《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自动编译的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product