Home > Article > Web Front-end > Detailed explanation of the use of d.ts files
This time I will bring you a detailed explanation of the use of d.ts files. What are the precautions when using d.ts files? Here are practical cases, let’s take a look.
Preface
This article mainly talks about how to write a typescript description file (a file name ending with d.ts, such as xxx.d. ts).
I recently started switching from js to ts. However, some description files (d.ts) are required. Commonly used ones such as jquery can be downloaded through npm to npm install @types/jquery that has been written by others. However, there are still some niche or internal public libraries within the company or public js codes that have been written before that require manual writing of description files.
I also found some information from the Internet before, but it was still unclear. After a period of exploration, I recorded the results of the exploration, and I hope it can give others a reference.
If you only write js, d.ts is also useful for you. Most editors can recognize d.ts files and give you intelligence when you write js code. hint. The effect looks like this:
For details, you can read some articles I have written before: http://www.jb51.net/article/138211.htm
Normally, when we write js, there are two ways to introduce js:
1. Globally introduce global variables in the html file through the