zl程序教程

您现在的位置是:首页 >  前端

当前栏目

[TypeScript] Installing TypeScript and Running the TypeScript Compiler (tsc)

typescript The and running compiler installing
2023-09-14 08:59:19 时间

This lesson shows you how to install TypeScript and run the TypeScript compiler against a .ts file from the command line.

 

install:

npm install -g typescript

tsc -v // version 

 

app.ts:

class Person{}

 

RUN:

tsc app.ts

You will see the js file with the same name.

 

If you want a different name, you can do :

tsc --out <output_filename> <input_filename>

tsc --out bundle.js app.ts

 

Watch files changes:

tsc -w --out bundle.js app.ts