TypeDoc is a powerful and flexible documentation generator designed specifically for TypeScript projects. It parses TypeScript source code and leverages the TypeScript compiler's API to extract type information, comments, and structure, transforming it into detailed API documentation, typically in HTML format. The current stable version is 0.28.19, and the project maintains an active release cadence, frequently delivering updates with new features, bug fixes, and support for the latest TypeScript versions. Its key differentiators include deep integration with the TypeScript ecosystem, robust support for monorepos and merging documentation from multiple packages, and extensive customization options through themes and configuration files. TypeDoc can automatically discover `tsconfig.json` and entry points, simplifying initial setup, while also providing fine-grained control over the generation process via command-line arguments and programmatic API.
npm install typedocVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to install TypeDoc, configure a basic TypeScript project, and generate API documentation using a package script with command-line options.
Upgrade your Node.js environment to version 18 or newer using tools like `nvm` or by installing a recent Node.js LTS version.
Ensure your project's `typescript` version matches one of the ranges specified in TypeDoc's `peerDependencies` (e.g., `^5.0.0`, `^5.4.0`). Update your `typescript` package if necessary.
Review your `basePath` usage; if internal links are resolving unexpectedly after upgrading, consider if `displayBasePath` is the more appropriate option for your use case.
Explicitly define entry points using `--entryPoints <path/to/files>` or configure `entryPointStrategy` (e.g., `packages`, `expand`) in your TypeDoc configuration or CLI arguments, especially for complex project structures.
Upgrade your Node.js environment to version 18 or newer. Use `node -v` to check your current version and `nvm install 18 && nvm use 18` or similar tools to manage Node.js versions.
Ensure a `tsconfig.json` file exists in your project root or specify its exact path using the `--tsconfig <path/to/tsconfig.json>` option.
Specify the files or directories to document using `--entryPoints <path/to/files>` (e.g., `src/index.ts`) or configure `entryPointStrategy` in your TypeDoc options (e.g., `typedoc --entryPointStrategy packages`).
Check that your project's `typescript` peer dependency aligns with TypeDoc's requirements. Try deleting `node_modules` and `package-lock.json` (or `pnpm-lock.yaml`), then reinstalling dependencies with `npm install` or `pnpm install`.