npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ts-add

v1.2.0

Published

Add packages with their corresponding types.

Downloads

53

Readme

All dependencies Reported vulnerabilities Commits NPM-version Total downloads Developed by
Publish size Install size Minified size Minified + gzipped size

[email protected]

Helps you conveniently add packages with their corresponding types to your project.

Installation

ts-add is available via NPM and recomended to install globally:

$ npm i -g [email protected]

You can also use ts-add via NPX without explicit installation:

$ npx ts-add ...

Synopsis

ts-add [-c completion] [-v version] [-h help]
ts-add [options]... package[@version] [[options] [package[@version]]]...

Aliases

  • tsa — for ts-add
  • tsi — for ts-add -i

Options

| Alias, name | Type | Description |-----------------------------------|---------|- | -d, --dry-run | boolean | Run without installing any packages. | -D, --save-dev | boolean | Save regular (not @types) packages into devDependencies. | -P, --save-prod | boolean | Save @types packages into regular dependencies. | -t, --types-only | boolean | Install only @types packages. | -i, --ignore-package-json | boolean | Add "latest" tag for all installing packages in case of latest versions are required to install. | --ap, --allow-prerelease | boolean | Allow to install prerelease versions of @types packages. | -s, --silent | boolean | Hide output messages. | -r, --registry | string | Specify any other package registry besides https://registry.npmjs.org (this value can be stored in .npmrc as registry key). | -a, --_auth | string | Set Auth Basic token for custom registry (this value can be stored in .npmrc as _auth key). | -l, --login | string | Set Auth Basic username for custom registry (this value can be stored in .npmrc as login key). | -u, --username | string | Alias for login. | -p, --password | string | Set Auth Basic password for custom registry (this value can be stored in .npmrc as password key). | -c, --completion | boolean | Output bash CLI autocompletion alias and exit. | -v, --version | boolean | Output version information and exit. | -h, --help | boolean | Display this help and exit.

Searching @types algorithm

  1. Look into package.json file of requested package. If there is types or typings field or files array includes .d.ts ending string in it so package has explicit types. Job's done.
  2. If not — search for @types package. If there is @types package search for its corresponding version:
    • for latest requested package — latest @types package;
    • for any other version — take max satisfying version by <major>.<minor>.x, where <major> and <minor> parts are taken from requested package.
      Notice: if you use ts-add without -i flag packages will be installed according to package.json versions and may have discrepancies in versions of main package and its @types. So consider to use -i flag to avoid this.
  3. If still not found — assume that package has no types.

Examples

-d, --dry-run

Use if you want to check what packages are supposed to install without their actual installation.

image

-D, --save-dev

Use if you want to save main packages into devDependencies.

image

-P, --save-prod

Similarly to save-dev but save @types packages into regular dependencies.

image

Note: you can use -D and -P flags at the same time, which means to swap packages install destination.

image

-t, --types-only

Install only correspondent @types packages for requested packages.

image

-i, --ignore-package-json

If there are no versions requested for installing packages NPM will rely on version ranges into package.json by default. If you don't want to involve package.json ranges just use -i flag or ts-add -i alias: tsi.

In case of the next dependencies:

{
  "dependencies": {
    "node-fetch": "~2.1.0"
  },
  "devDependencies": {
    "@types/node-fetch": "~2.1.7"
  }
}

image

The --ignore-package-json flag simply add latest tag for packages with no provided versions so NPM doesn't rely on already installed packages in package.json.

image

--ap, --allow-prerelease

Include to search pool @types prerelease package versions such as 2.3.5-beta-1, 3.0.1-rc-4 and so on.

-r, --registry

Provide a custrom registry to search for packages.

tsi my-awesome-module -r=https://my-awesome-registry.com

The registry key can also conveniently be stored in the .npmrc file.

-a, --_auth, -l, --login, -p, --password

Provide credentials for registry authentication.

By Auth Basic token

tsi my-awesome-module -a=<my-awesome-auth-basic-token>

By Basic login + password pair

tsi my-awesome-module -l=<login> -p=<password>

By credential embedded into registry URL

tsi my-awesome-module -r=https://<login>:<password>@my-awesome-registry.com

Keys _auth, login and password can also conveniently be stored in the .npmrc file.

-c, --completion

Run tsa -c >> ~/.bashrc command to append CLI autocomplection into .bashrc file.

Testing

Manually tested by the developer during development. Automated tests are not provided.


Your improve suggestions and bug reports are welcome any time.