
Product
Introducing Socket Scanning for OpenVSX Extensions
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.
Helps you conveniently add packages with their corresponding types to your project.
ts-add is available via NPM and recomended to install globally:
$ npm i -g ts-add@1.2.0
You can also use ts-add via NPX without explicit installation:
$ npx ts-add ...
ts-add [-c completion] [-v version] [-h help]
ts-add [options]... package[@version] [[options] [package[@version]]]...
tsa — for ts-addtsi — for ts-add -i| 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. |
@types algorithmpackage.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.@types package. If there is @types package search for its corresponding version:
@types package;<major>.<minor>.x, where <major> and <minor> parts are taken from requested package.-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.Use if you want to check what packages are supposed to install without their actual installation.

Use if you want to save main packages into devDependencies.

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

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

Install only correspondent @types packages for requested packages.

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"
}
}

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.

Include to search pool @types prerelease package versions such as 2.3.5-beta-1, 3.0.1-rc-4 and so on.
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.
Provide credentials for registry authentication.
tsi my-awesome-module -a=<my-awesome-auth-basic-token>
tsi my-awesome-module -l=<login> -p=<password>
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.
Run tsa -c >> ~/.bashrc command to append CLI autocomplection into .bashrc file.
Manually tested by the developer during development. Automated tests are not provided.
Your improve suggestions and bug reports are welcome any time.
FAQs
Add packages with their corresponding types.
We found that ts-add demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.

Product
Bringing supply chain security to the next generation of JavaScript package managers

Product
A safer, faster way to eliminate vulnerabilities without updating dependencies