How to use vscode to run ts code

1.Install  typescript

npm install -g typescript

//检查是否安装
tsc -v

 2. Generate the configuration file, cd into the folder, and enter in the console

tsc --init

 3. Open the json file, uncomment outDir, which refers to the compiled path, and create a new folder js to store the compiled js.

 4.

 

Finally, take a look at the renderings:

 

If you use webpack to manage ts, you need to install ts-loader to convert ts to js files.

cnpm i -D ts-loader typescript 

Configuration file configuration related configuration information

 

Guess you like

Origin blog.csdn.net/qq_26695613/article/details/127486004