Home  >  Article  >  Web Front-end  >  Detailed explanation of the steps to obtain the TypeScript declaration file .d.ts

Detailed explanation of the steps to obtain the TypeScript declaration file .d.ts

php中世界最好的语言
php中世界最好的语言Original
2018-05-14 14:21:143373browse

This time I will give you a detailed explanation of the steps to obtain the TypeScript declaration file .d.ts, and what are the precautions for obtaining the TypeScript declaration file .d.ts. The following is a practical case, let's 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/<a href="http://www.php.cn/wiki/1495.html" target="_blank">jquery</a> -g

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:

Detailed explanation of the steps to implement full-screen scrolling plug-in in ES6

##vue vue-router vuex operation permissions

The above is the detailed content of Detailed explanation of the steps to obtain the TypeScript declaration file .d.ts. 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