How can I efficiently tell if a batch of NPM packages has types?

59 Views Asked by At

With the NPM registry API, I would like to determine whether a package has types. So far, I have this process, but I'm wondering if there is a better way to check:

  • Query for @types/<package> (or download the DefinitelyTyped repository and check there, which is what I do for efficiency)
  • Download the tarball for the package, unzip it, and check for types in package.json

I run this process for a few thousand packages.

However, I would like to make the latter check more efficient, given that the NPM website indicates whether a package has types.

Is there a simple way to accomplish this that doesn't require downloading tarballs?

0

There are 0 best solutions below