Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of using ts in vscode

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article is about the use of ts in vscode. Xiao Bian thinks it is quite practical, so share it for everyone to make a reference. Let's follow the editor and have a look.

Steps:

Open the command line and type npm i -g typescript to install TS globally.

2, continue to type tsc -init in the command line environment to initialize, you will find more tsconfig.json file in the root directory, recording the option to compile into JS.

3, open the file, you will find that the main options have been set for you, the more common settings are:

(1)"target": what specification is compiled, generally set to ES5 or ES2016/2017;

(2)"outdir": output directory;

(3)"alwaysStrict": turn on strict mode ('use strict');

4. Enter code at the command line. Open VSCode to enter the directory, press Ctrl+shift+B shortcut key to compile, the first compilation will select compile mode.

Monitor mode is automatically compiled whenever TS file changes, build mode is compiled when manual command is compiled, here select monitor mode.

5. Press F5 to start debugging. The initial debugging will let you choose the debugging environment.

This is chosen according to the host environment of your JS, and this article uses the NODE environment.

6. There is a configuration button above the debugging button. Click to modify the debugging in detail.

Thank you for reading! About vscode in the use of ts method to share here, I hope the above content can have some help for everyone, so that we can learn more knowledge. If you think the article is good, you can share it so that more people can see it!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report