Gathering detailed insights and metrics for npm-dts
Gathering detailed insights and metrics for npm-dts
Gathering detailed insights and metrics for npm-dts
Gathering detailed insights and metrics for npm-dts
@ts-type/package-dts
A Typescript type definition for NPM package json
npm-dts-webpack-plugin
Webpack plugin generating single dts file for bundling TypeScript NPM packages
@definitelytyped/dts-critic
Checks a new .d.ts against the Javascript source and tells you what problems it has
cet-dts
## Project setup ``` npm install ```
Generates single dts file for bundling TypeScript NPM packages
npm install npm-dts
Typescript
Module System
Node Version
NPM Version
81.7
Supply Chain
97.6
Quality
76
Maintenance
100
Vulnerability
99.3
License
TypeScript (89.07%)
JavaScript (10.93%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
140 Stars
91 Commits
10 Forks
1 Watchers
1 Branches
2 Contributors
Updated on Jun 25, 2025
Latest Version
1.3.13
Package Id
npm-dts@1.3.13
Unpacked Size
286.61 kB
Size
86.16 kB
File Count
23
NPM Version
9.5.1
Node Version
18.16.1
Published on
Aug 02, 2024
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
by Vytenis Urbonavičius
This utility generates single index.d.ts file for whole NPM package.
It allows creating bundled NPM library packages without TypeScript sources and yet still keeping code suggestions wherever these libraries are imported.
TypeScript picks up index.d.ts automatically.
Local:
npm install --save-dev npm-dts
Global:
npm install -g npm-dts
Please make sure that target project has "typescript" installed in node_modules.
To see full CLI help - run without arguments:
npm-dts
Typical usage (using global install):
cd /your/project
npm-dts generate
npm-dts [options] generate
Option | Alias | Description |
---|---|---|
--entry [file] | -e [file] | Allows changing main src file from index.ts to something else. It can also be declared as a path, relative to rootDir of TSC. Note that if rootDir is not specified in tsconfig.json and all TS source code is under some sub-directory such as "src" - TSC might auto-magically set rootDir to "src". |
--force | -f | Ignores non-critical errors and attempts to at least partially generate typings (disabled by default). |
--help | -h | Output usage information. |
--logLevel [level] | -L [level] | Log level (error, warn, info, verbose, debug) (defaults to "info"). |
--output [file] | -o [file] | Overrides recommended output target to a custom one (defaults to "index.d.ts"). |
--root [path] | -r [path] | NPM package directory containing package.json (defaults to current working directory). |
--tmp [path] | -t [path] | Directory for storing temporary information (defaults to OS-specific temporary directory). Note that tool completely deletes this folder once finished. |
--tsc [options] | -c [options] | Passed through additional TSC options (defaults to ""). Note that they are not validated or checked for suitability. When passing through CLI it is recommended to surround arguments in quotes and start with a space (work-around for a bug in argument parsing dependency of npm-dts). |
--version | -v | Output the version number. |
You would want to use "npm-dts-webpack-plugin" package instead.
Example of how you could run generation of index.d.ts automatically before every publish.
{
// ......
"scripts": {
"prepublishOnly": "npm run dts && ......",
"dts": "./node_modules/.bin/npm-dts generate"
}
// ......
}
Another possible option would be to execute "npm run dts" as part of bundling task.
This approach can be used for integration with tools such as WebPack.
Simple usage with all default values:
1import {Generator} from 'npm-dts' 2new Generator({}).generate()
Advanced usage example with some arguments overridden:
1import * as path from 'path' 2import {Generator} from 'npm-dts' 3 4new Generator({ 5 entry: 'main.ts', 6 root: path.resolve(process.cwd(), 'project'), 7 tmp: path.resolve(process.cwd(), 'cache/tmp'), 8 tsc: '--extendedDiagnostics', 9}).generate()
Above examples were in TypeScript. Same in plain JavaScript would look like this:
1const path = require('path') 2 3new (require('npm-dts').Generator)({ 4 entry: 'main.ts', 5 root: path.resolve(process.cwd(), 'project'), 6 tmp: path.resolve(process.cwd(), 'cache/tmp'), 7 tsc: '--extendedDiagnostics', 8}).generate()
Constructor of generator also supports two more boolean flags as optional arguments:
Initializing without any options will cause npm-cli to read CLI arguments all by itself.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
5 existing vulnerabilities detected
Details
Reason
Found 0/17 approved changesets -- score normalized to 0
Reason
0 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More