Typeroll is a high-performance TypeScript declaration file generator and bundler designed to consolidate all `.d.ts` files into a single output. It focuses on speed and simplicity, making it ideal for library authors who need to ship a unified declaration file for their packages. Currently at version 0.7.7, it is under active development with a release cadence typically tied to critical bug fixes, performance enhancements, and compatibility with newer TypeScript versions. Its primary differentiator is the ability to produce a highly optimized, single declaration file, often outperforming the built-in `tsc --emitDeclarationOnly` for bundling scenarios, especially in larger projects. It provides a programmatic API for integration into build workflows.
npm install typerollVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to programmatically use Typeroll to bundle TypeScript declaration files. It creates a small dummy project with a `tsconfig.json` and two `.ts` files, then calls the `bundle` function to output a single `.d.ts` file.
Always pin to exact minor versions (e.g., `"typeroll": "~0.7.0"` or `"^0.7.x"` if comfortable with patch fixes only) and consult the project's GitHub releases or changelog before updating.
Ensure your `tsconfig.json` is correctly configured for declaration generation (`declaration: true`). For complex path aliases, explicitly define `paths` in `tsconfig.json` and ensure they resolve correctly within your project structure. Using `cwd` in bundle options can help resolve paths correctly.
Check Typeroll's `package.json` for the exact `typescript` peer dependency range. Ensure your project's `typescript` version falls within this range. If issues persist, try aligning your `typescript` version exactly with the one Typeroll was tested against, if specified.
Ensure you are using ESM `import` syntax: `import { bundle } from 'typeroll';`. Also, verify `typeroll` is listed in your `package.json` dependencies and installed correctly (`npm install` or `yarn install`).Ensure all files intended for bundling are proper modules (have `import` or `export` statements). If global declarations are intentional, consider carefully how they are exposed and ensure uniqueness, or adjust your bundling strategy to avoid including conflicting global scripts.
Verify your `typescript` peer dependency matches Typeroll's requirements. Double-check your `tsconfig.json` for any syntax errors or logical inconsistencies that might prevent `tsc` from compiling your source files successfully on its own. Run `tsc --noEmit` on your source to diagnose underlying TS errors.