In this guide, we’ll assume basic familiarity with the TypeScript language.If you haven’t already, you should read the to familiarize yourself with basic concepts, especially types and namespaces.

    Sections

    The guide is broken down into the following sections.

    By Example

    Many times, we are faced with writing a declaration file when we only have examples of the underlying library to guide us.The By Example section shows many common API patterns and how to write declarations for each of them.This guide is aimed at the TypeScript novice who may not yet be familiar with every language construct in TypeScript.

    Many common mistakes in declaration files can be easily avoided.The section identifies common errors, describes how to detect them, and how to fix them.Everyone should read this section to help themselves avoid common mistakes.

    Deep Dive

    In you’ll find a number of declaration files that serve as a useful starting point when writing a new file.Refer to the documentation in Library Structures to figure out which template file to use.

    Publish to npm

    The Publishing section explains how to publish your declaration files to an npm package, and shows how to manage your dependent packages.