Skip to content
AgileLogics
4 min read

Package and Library Design

Prerequisites: Declaration files

A TypeScript package meant for other developers to install should ship its own .d.ts declaration files (generated automatically by tsc with "declaration": true), so consumers get full type checking and autocomplete without installing a separate @types package.

{
  "main": "dist/index.js",
  "types": "dist/index.d.ts"
}

The types field in package.json tells TypeScript (and editors) where to find the package's own declaration file.