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

Viewed 3500

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
1 Answers

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

Current instructions for installation, when using yarn v2 is:

yarn plugin import typescript

yarn v2 isn't Generally Available yet, but currently has release candidates leading up to that.

Related