Curriculum
Course: TypeScript
Login
Text lesson

TS Definitely Typed

NPM packages in the JavaScript ecosystem don’t always include type definitions. This may be due to projects being unmaintained, or the authors not using or supporting TypeScript.

Using non-typed NPM packages in TypeScript

Using untyped NPM packages with TypeScript lacks type safety due to missing types. To assist TypeScript developers, Definitely Typed is a community-maintained project that offers a central repository of TypeScript definitions for NPM packages without built-in types.

Example

npm install –save-dev @types/jquery

Once the declaration package is installed, no additional steps are typically required. TypeScript will automatically detect and use the types when you use the package.

Editors like Visual Studio Code often suggest installing such packages when types are missing.