node.js – What is @types npm and how does it work?


I'm starting a project with NodeJS and TypeScript and the instructor told me to install @types/node , in addition to the TypeScript TypeScript package. He was quick to mention that @types/node creates TypeScript types for Node entities, but would like a more in-depth explanation of how this works.


This package in scope @types is where we can find several useful type definitions, such as, for example, the Node type definitions that allow us to use, for example, require to import modules.

Node's @types package contains type definitions for many libraries such as Express, Sequelize, JQuery and many others. Basically what it does is:

  • check if the package you are using already has built-in types, and if you prefer, prefer these;
  • check that the type definitions have already been shipped with the compiler.

This link: Typescript Typings – The Complete Guide To Type Definitions: @types, Compiler Opt-In Types: When To Use Each and Why? It has material to explain Types and I think it's worth a look. Hope this helps.

Scroll to Top