Skip to main content

TypeScript Definitely Typed

Not every npm package in the JavaScript world ships with TypeScript types.

Sometimes the project is no longer maintained. Other times the authors are not interested in TypeScript, do not agree with it, or simply have no time to add types.


Using non-typed NPM packages in TypeScript

Using an npm package that has no types is not type-safe, because TypeScript knows nothing about it.

To help, there is a community project called Definitely Typed. It is one central repository of TypeScript type definitions for npm packages that do not include their own.

The definitions are published as packages under the @types scope. To add the types for jQuery, for example, run:

  • npm install --save-dev @types/jquery

Usually nothing else is needed after installing the declaration package. TypeScript finds the types automatically when you use the package.

Note: Editors such as Visual Studio Code often suggest installing a matching @types package when types are missing.