
Research
/Security News
GlassWASM: WebAssembly Malware Found in Trojanized Open VSX Extensions
The trojanized extensions use TinyGo-compiled WebAssembly and Solana transaction memos to resolve command-and-control infrastructure.
@qlik/dts-bundler
Advanced tools
A tool for bundling TypeScript files (.ts and/or .d.ts) by inlining local imports and optionally inlining types from specified npm packages. Works both as a CLI tool and as a library you can import in your Node.js projects.
./ or ../)import type statementsexport * from statementsdeclare module "..." blocks for external modulesdeclare global support — Control whether declare global blocks are inlined or preservedexport as namespacepreserveConstEnums compiler option/// <reference types="..." /> for @types/* packagesnpm install @qlik/dts-bundler
# or
pnpm add @qlik/dts-bundler
# or
yarn add @qlik/dts-bundler
import { bundleTypes } from "@qlik/dts-bundler";
import fs from "fs";
// Basic usage - returns bundled content as string
const bundledContent = bundleTypes({
entry: "./src/types.ts",
});
// Write to file
fs.writeFileSync("./dist/bundle.d.ts", bundledContent);
// With inlined libraries
const bundledWithLibs = bundleTypes({
entry: "./src/types.ts",
inlinedLibraries: ["@my-org/types", "some-package"],
inlineDeclareExternals: true,
});
fs.writeFileSync("./dist/bundle.d.ts", bundledWithLibs);
bundle-types -e < entry > -o < output > [-i < inlinedLibraries > ]
-e, --entry <file> - Required: Entry TypeScript file to bundle-o, --output <file> - Required: Output file path for bundled types-i, --inlinedLibraries <list> - Optional: Comma-separated list of npm packages to inline-h, --help - Show help messageBasic usage (inline only local imports):
bundle-types -e ./src/types.ts -o ./dist/bundle.d.ts
With npm package inlining:
bundle-types \
-e ./src/types.ts \
-o ./dist/bundle.d.ts \
-i @my-org/types-pkg,@another/types-pkg
Using npm scripts (add to package.json):
{
"scripts": {
"bundle-types": "bundle-types -e ./src/types.ts -o ./dist/bundle.d.ts"
}
}
Then run:
npm run bundle-types
When publishing a library, bundle internal types but keep framework types external:
import { bundleTypes } from "@qlik/dts-bundler";
import fs from "fs";
const bundled = bundleTypes({
entry: "./src/index.ts",
inlinedLibraries: ["@my-company/internal-types"],
});
fs.writeFileSync("./dist/index.d.ts", bundled);
In a monorepo, inline types from your own packages:
bundle-types \
-e ./src/types.ts \
-o ./dist/types.d.ts \
-i @myorg/pkg-a,@myorg/pkg-b,@myorg/pkg-c
Create a single file with all types for easy distribution:
import { bundleTypes } from "@qlik/dts-bundler";
import fs from "fs";
const bundled = bundleTypes({
entry: "./src/api.types.ts",
});
fs.writeFileSync("./api-complete.d.ts", bundled);
Integrate into your build process:
// build.js
import { bundleTypes } from "@qlik/dts-bundler";
import fs from "fs";
async function build() {
// ... other build steps
const bundled = bundleTypes({
entry: "./src/public-api.ts",
});
fs.writeFileSync("./dist/index.d.ts", bundled);
console.log("✓ Types bundled!");
}
build();
The bundler performs the following steps:
./ or ../) are always resolved and inlinedinlinedLibraries list are also inlinedexport {} statement ensures the file is treated as a modulesrc/types.ts:
import type { ExternalType } from "@external/package";
import type { LocalType } from "./local-types";
export interface MyType extends LocalType {
external: ExternalType;
}
src/local-types.ts:
export interface LocalType {
id: string;
name: string;
}
dist/bundle.d.ts:
// Generated by @qlik/dts-bundler
import type { ExternalType } from "@external/package";
export interface LocalType {
id: string;
name: string;
}
export interface MyType extends LocalType {
external: ExternalType;
}
export {};
For complete API documentation, see the API Reference.
bundleTypes(options)Bundle TypeScript declaration files.
import { bundleTypes } from "@qlik/dts-bundler";
import fs from "fs";
const bundled = bundleTypes({
entry: "./src/types.ts",
inlinedLibraries: ["@my-org/types"],
inlineDeclareExternals: true,
});
fs.writeFileSync("./dist/bundle.d.ts", bundled);
| Option | Type | Default | Description |
|---|---|---|---|
entry | string | — | (Required) Entry TypeScript file path |
inlinedLibraries | string[] | [] | Libraries to inline into the bundle |
allowedTypesLibraries | string[] | undefined | @types/* packages for triple-slash references |
importedLibraries | string[] | undefined | Libraries to keep as imports |
inlineDeclareGlobals | boolean | false | Inline declare global blocks |
inlineDeclareExternals | boolean | false | Inline declare module blocks |
exportReferencedTypes | boolean | false | Auto-export referenced types |
noBanner | boolean | false | Exclude banner comment |
sortNodes | boolean | false | Sort declarations alphabetically |
umdModuleName | string | undefined | UMD module name (export as namespace) |
respectPreserveConstEnum | boolean | false | Respect tsconfig preserveConstEnums |
See the full API documentation for detailed descriptions and examples of each option.
Multiple libraries: Separate with commas (CLI) or use an array (library)
# CLI
-i @org/pkg1,@org/pkg2,@org/pkg3
// Library
inlinedLibraries: ["@org/pkg1", "@org/pkg2", "@org/pkg3"];
Scoped packages: Include the full scope
inlinedLibraries: ["@mycompany/types", "@anothercompany/utils"];
Package subpaths: Specify the exact import path
inlinedLibraries: ["@mycompany/types/dist/api"];
Check the output: Always verify the generated file matches your expectations
bundle-types -e ./src/types.ts -o ./dist/bundle.d.ts
head -50 ./dist/bundle.d.ts
.ts, .tsx, .mts, .cts, .d.ts, .d.mts, .d.cts)tsc for that)This warning appears when the bundler cannot find an imported file. Check:
.ts, .tsx, or .d.ts extensionIf you see duplicate types in the output, ensure:
If the entry file doesn't exist, the process will exit with code 1. Ensure:
The project uses vitest for testing with snapshot testing for output verification.
# Run tests
pnpm test
# Run tests in watch mode
pnpm test:watch
# Update snapshots when output changes are intentional
pnpm test:update
Tests use snapshots to verify bundler output. If you make changes that affect the generated output:
pnpm test to see the diffpnpm test:update to update snapshotsContributions are welcome! Please feel free to submit a Pull Request.
ISC
FAQs
Bundle TypeScript declaration files into a single file
We found that @qlik/dts-bundler demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers 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.

Research
/Security News
The trojanized extensions use TinyGo-compiled WebAssembly and Solana transaction memos to resolve command-and-control infrastructure.

Security News
Anthropic says the directive cited national security concerns over a narrow jailbreak, but offered no specific technical details.

Security News
A network of 152 Chrome live wallpaper extensions hid ad tracking and made extension-driven traffic look like Google search clicks.