How to install ts

We all use npm to install TypeScript.

We can open the " Command Collection " by pressing window+R .

Enter cmd to get the CMD command prompt

first step:

npm install -g typescript

Use it to install modules

Step two:

tsc -v

You can use this command to view the version number

third step:

We need to create a folder, on the desktop or somewhere else.

When the folder is opened, ts is created.

 

Click to create a ts page and change the suffix name to, for example: demo.ts.

the fourth step:

Initialize folders and automate detection.

To open the background terminal, we can use the window+~ key.

first step:

 

tsc -init或者tsc --init

Initialize the folder and add the configuration folder.

Step two:

tsc -w

Automatically detect synchronization, Js files.

Enter the name of the file currently created by tsc, such as: demo.ts.

Automatically create js folder

Enter node plus the current file name, such as: demo

Get synchronized content.

Achievable results.

tsc --init

 

tsc demo.ts

 

node demo

 

The content written on the ts page.

 

 

 

Guess you like

Origin blog.csdn.net/qq_48294048/article/details/127247931