Home  >  Article  >  Web Front-end  >  Get TypeScript declaration file .d.ts method analysis (with code)

Get TypeScript declaration file .d.ts method analysis (with code)

php中世界最好的语言
php中世界最好的语言Original
2018-06-01 13:54:062899browse

This time I will bring you the analysis of the method of obtaining the TypeScript declaration file .d.ts (with code) and the precautions for obtaining the TypeScript declaration file .d.ts. The following is a practical case. Get up and take a look.

1. TypeScript declaration file is like C/C using .h file. When using TypeScript to call other

class libraries that have been written, IntelliSense intelligent prompts can be provided.

2. Use the npm command to obtain the .d.ts file

install -save @types/jquery<a href="http://www.php.cn/wiki/1495.html" target="_blank"> -g </a>

After running, four files will be generated in the type/jquery directory: index.d.ts, lincense, package.json, readme.md, where index.d.ts is the declaration file of jquery.

3. npm requires Nodejs environment,

InstallationThe steps are as follows

1. Download windows installation from

https://nodejs.org/en/ Package

2. Install Node, js

3. After the installation is completed, open the cmd command line tool of windows and enter

npm -v

Display the version number, indicating successful installation

4. Set the global path to "d:\nodejs\node_global"

npm config set prefix "d:\nodejs\node_global"
I believe you have mastered the method after reading the case in this article. For more exciting content, please pay attention to other related articles on the php Chinese website!

Recommended reading:

How to use slots in Vue to distribute parent components

How to operate vue from the list through id Page jump details page

The above is the detailed content of Get TypeScript declaration file .d.ts method analysis (with code). For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn