好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

搭建typescript练习环境

-

1、node环境自备

2、全局安装typescript

 npm install -g typescript

3、在VSCODE编辑器中新建TS文件夹

创建src根目录 创建app.ts 编写你的TS代码

(1)通过命令行运行TS文件

tsc ./src/app.ts --outFile ./dist/ app.js
tsc . /src/* --outDir ./dist --watch

(2)可以通过tsconfig.json配置文件运行

tsc --init 修改配置文件

"outDir": "./dist" ,
 "rootDir": "./src"

启动

tsc --watch

在app.ts中编辑的ts代码会实时的编译到dist/app.js中

 

 

 

 

-

查看更多关于搭建typescript练习环境的详细内容...

  阅读:63次