Home > Web Front-end > JS Tutorial > body text

How to make d.ts file

php中世界最好的语言
Release: 2018-06-08 13:52:14
Original
2469 people have browsed it

This time I will show you how to make a d.ts file and what are the precautions for making a d.ts file. The following is a practical case, 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 smart prompts when you write js code. 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

Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!