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