Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does npm or yarn have feature to automatically install @types if they exist in Typescript projects?

Does npm or yarn have feature to automatically install @types/* for packages without own types, if they exist in Typescript projects?

Something like:

//package.json
{
  // ...
  installTypes: true
}

// installing package
yarn add ABC <- will install ABC + @types/ABC
like image 293
Baterka Avatar asked Oct 14 '25 08:10

Baterka


1 Answers

There's a yarn v2+ plugin for this at https://www.npmjs.com/package/@yarnpkg/plugin-typescript

Since yarn v4, its included by default.

Instructions for installation, when using yarn v2 or v3 is:

yarn plugin import typescript
like image 179
Andy Avatar answered Oct 17 '25 20:10

Andy