Posts in current category
May 07, 2021 22:00 TypeScript
The purpose of this guide is to teach you how to write high-quality TypeScript declaration files.
In this guide, let's assume that you already have a basic understanding of TypeScript. If not, read the TypeScript manual first to learn some basics, especially the type and namespace sections.
This guide is divided into the following sections.
The Structures section will help you understand the format of common libraries and how to write the correct declaration files for each format. I f you're editing a file that already exists, you probably don't need to read this section. If you are writing a new declaration file, you must read this section to understand how the different formats of the library affect the writing of the declaration file.
There are many common errors in the claim file that are easy to avoid. The Specification section points out common errors and describes how to find them and how to fix them. Everyone should read this section to learn how to avoid common mistakes.
Many times, we can only look at examples of how third-party libraries work, and we need to write declaration files for such libraries. The section shows many common API patterns and how to write declaration files for them. This guide is for Beginners of TypeScript, who may not yet understand all the language structures in TypeScript.
For those veterans who are interested in the underlying workings of claims files, the in-depth section explains a number of advanced concepts for writing claims files and shows how these concepts can be used to create clean and intuitive claims files.
In the Template section, you'll find declaration files that can help you get started quickly when you're writing a new claims file. Refer to Structure This document finds which template file should be used.
The Release section explains how to publish a declaration file as an npm package and how to manage the dependencies of the package.