Gathering detailed insights and metrics for dts-generator
Gathering detailed insights and metrics for dts-generator
Gathering detailed insights and metrics for dts-generator
Gathering detailed insights and metrics for dts-generator
dts-bundle-generator
DTS Bundle Generator
npm-dts
Simple DTS single-file generation utility for TypeScript bundles
@types/dts-generator
TypeScript definitions for dts-generator
@rushstack/typings-generator
This library provides functionality for automatically generating typings for non-TS files.
Generates a single .d.ts bundle containing external module declarations exported from TypeScript module files.
npm install dts-generator
Typescript
Module System
Node Version
NPM Version
95.9
Supply Chain
98.6
Quality
74.4
Maintenance
100
Vulnerability
98.6
License
TypeScript (94.56%)
JavaScript (2.78%)
Batchfile (1.56%)
Shell (1.1%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
522 Stars
96 Commits
65 Forks
33 Watchers
15 Branches
21 Contributors
Updated on Jul 13, 2025
Latest Version
3.0.0
Package Id
dts-generator@3.0.0
Size
10.21 kB
NPM Version
6.4.1
Node Version
10.13.0
Published on
Jan 08, 2019
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
5
Generates a single .d.ts
bundle containing external module declarations exported from TypeScript module files.
If you have a project with lots of individual TypeScript files that are designed to be consumed as external modules,
the TypeScript compiler doesn’t allow you to actually create a single bundle out of them. This package leverages the
TypeScript language services in TypeScript 1.4+ to generate a single .d.ts
file containing multiple
declare module 'foo'
declarations. This allows you to distribute a single .d.ts
file along with your compiled
JavaScript that users can simply reference from the TypeScript compiler using a /// <reference path />
comment.
.d.ts
generator will also correctly merge non-external-module files, and any already-existing .d.ts
files.
npm install dts-generator
Generate your d.ts
bundle:
Programmatically:
1require('dts-generator').default({ 2 name: 'package-name', 3 project: '/path/to/package-directory', 4 out: 'package-name.d.ts' 5});
Command-line:
1dts-generator --name package-name --project /path/to/package-directory --out package-name.d.ts
Grunt:
1module.exports = function (grunt) {
2 grunt.loadNpmTasks('dts-generator');
3 grunt.initConfig({
4 dtsGenerator: {
5 options: {
6 name: 'package-name',
7 project: '/path/to/package-directory',
8 out: 'package-name.d.ts'
9 },
10 default: {
11 src: [ '/path/to/package-directory/**/*.ts' ]
12 }
13 }
14 });
15};
1/// <reference path="typings/package-name.d.ts" /> 2 3import Foo = require('package-name/Foo'); 4 5// ...
baseDir?: string
: The base directory for the package being bundled. Any dependencies discovered outside this
directory will be excluded from the bundle. Note this is no longer the preferred way to configure dts-generator
,
it automatically gets its value from compiler option rootDir
if specified in tsconfig.json
, otherwise it gets value from project
. Please see option project
.exclude?: string[]
: A list of glob patterns, relative to baseDir
, that should be excluded from the bundle. Use
the --exclude
flag one or more times on the command-line. Defaults to [ "node_modules/**/*.d.ts" ]
.externs?: string[]
: A list of external module reference paths that should be inserted as reference comments. Use
the --extern
flag one or more times on the command-line.types?: string[]
: A list of external @types package dependencies that should be inserted as reference comments. Use
the --types
flag one or more times on the command-line.files: string[]
: A list of files from the baseDir to bundle.eol?: string
: The end-of-line character that should be used when outputting code. Defaults to os.EOL
.indent?: string
: The character(s) that should be used to indent the declarations in the output. Defaults to \t
.main?: string
: The module ID that should be used as the exported value of the package’s “main” module.moduleResolution?: ts.ModuleResolutionKind
: The type of module resolution to use when generating the bundle.name: string
: The name of the package. Used to determine the correct exported package name for modules.out: string
: The filename where the generated bundle will be created.project?: string
: The base directory for the project being bundled. It is assumed that this directory contains a tsconfig.json
which will be parsed to determine the files that should be bundled as well as other configuration information like target
target?: ts.ScriptTarget
: The target environment for generated code. Defaults to ts.ScriptTarget.Latest
.resolveModuleId: (params: ResolveModuleIdParams) => string
: An optional callback provided by the invoker to customize the declared module ids the output d.ts files. For details see resolving module ids.resolveModuleImport: (params: ResolveModuleImportParams) => string
: An optional callback provided by the invoker to customize the imported module ids in the output d.ts files. For details see resolving module ids.@fdecampredon for the idea to dump output from the compiler emitter back into the compiler parser instead of trying to figure out how to influence the code emitter.
© 2015-2019 SitePen, Inc. New BSD License.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
Found 20/30 approved changesets -- score normalized to 6
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-14
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