Create api documentation for TypeScript projects.
—
Core application orchestration for TypeDoc documentation generation, including bootstrapping, plugin loading, configuration management, and conversion coordination.
Main orchestrator for TypeDoc operations that manages all core components and coordinates the documentation generation process.
/**
* The TypeDoc application orchestrates the entire documentation generation process.
* It manages converter, renderer, serializer, and other core components.
*/
class Application extends AbstractComponent<Application, ApplicationEvents> {
/** Options container with all configuration */
readonly options: Options;
/** Converter for TypeScript source to reflections */
readonly converter: Converter;
/** Renderer for generating output files */
readonly renderer: Renderer;
/** Serializer for JSON output */
readonly serializer: Serializer;
/** Internationalization support */
readonly internationalization: Internationalization;
/** Logger for application messages */
readonly logger: Logger;
/** Bootstrap application with basic options */
static bootstrap(options?: Partial<TypeDocOptions>): Promise<Application>;
/** Bootstrap application with plugins and option readers */
static bootstrapWithPlugins(
options: Partial<TypeDocOptions>,
readers: OptionsReader[]
): Promise<Application>;
/** Convert TypeScript source files to documentation model */
convert(): Promise<ProjectReflection | undefined>;
/** Convert with file system watching for development */
convertAndWatch(success: (project: ProjectReflection) => Promise<void>): Promise<never>;
/** Generate HTML documentation output */
generateDocs(project: ProjectReflection, out: string): Promise<void>;
/** Generate JSON documentation output */
generateJson(project: ProjectReflection, out: string): Promise<void>;
/** Validate project documentation completeness */
validate(project: ProjectReflection): void;
}Usage Examples:
import { Application } from "typedoc";
// Basic application setup
const app = await Application.bootstrap({
entryPoints: ["src/index.ts"],
out: "docs",
});
// Advanced setup with custom configuration
const app = await Application.bootstrapWithPlugins(
{
entryPoints: ["src/"],
entryPointStrategy: "expand",
out: "docs/api",
theme: "default",
excludeExternals: true,
categorizeByGroup: false,
},
[
new ArgumentsReader(0),
new TypeDocReader(),
new TSConfigReader(),
]
);
// Generate documentation
const project = await app.convert();
if (project) {
await app.generateDocs(project, "docs");
// Also generate JSON for custom processing
await app.generateJson(project, "docs/api.json");
// Validate documentation completeness
app.validate(project);
}Static methods for initializing TypeDoc applications with various configuration approaches.
/**
* Bootstrap a TypeDoc application with simple options
* @param options - Partial configuration options
* @returns Promise resolving to configured Application instance
*/
static bootstrap(options?: Partial<TypeDocOptions>): Promise<Application>;
/**
* Bootstrap application with plugin loading and multiple option readers
* @param options - Base configuration options
* @param readers - Array of option readers for loading configuration
* @returns Promise resolving to fully configured Application instance
*/
static bootstrapWithPlugins(
options: Partial<TypeDocOptions>,
readers: OptionsReader[]
): Promise<Application>;Core methods for converting TypeScript source code to documentation and generating various output formats.
/**
* Convert TypeScript source files to TypeDoc's reflection model
* @returns Promise resolving to ProjectReflection or undefined if conversion fails
*/
convert(): Promise<ProjectReflection | undefined>;
/**
* Convert with file system watching for development workflows
* @param success - Callback executed when conversion succeeds
* @returns Promise that never resolves (runs indefinitely)
*/
convertAndWatch(success: (project: ProjectReflection) => Promise<void>): Promise<never>;
/**
* Generate HTML documentation from project reflection
* @param project - The converted project reflection
* @param out - Output directory path
*/
generateDocs(project: ProjectReflection, out: string): Promise<void>;
/**
* Generate JSON output from project reflection
* @param project - The converted project reflection
* @param out - Output file path for JSON
*/
generateJson(project: ProjectReflection, out: string): Promise<void>;
/**
* Validate project documentation for completeness and issues
* @param project - The project reflection to validate
*/
validate(project: ProjectReflection): void;Events dispatched during application lifecycle for plugin integration and custom processing.
interface ApplicationEvents {
/** Fired when application bootstrap process completes */
BOOTSTRAP_END: [Application];
/** Fired when project is revived from JSON */
REVIVE: [ProjectReflection, JSONOutput.ProjectReflection];
}Usage Examples:
import { Application } from "typedoc";
const app = await Application.bootstrap();
// Listen for bootstrap completion
app.on("BOOTSTRAP_END", (app) => {
console.log("Application bootstrap completed");
console.log("Loaded plugins:", app.options.getValue("plugin"));
});
// Listen for project revival from JSON
app.on("REVIVE", (project, jsonProject) => {
console.log("Project revived:", project.name);
console.log("Original JSON version:", jsonProject.packageVersion);
});Development-friendly watching functionality for automatic regeneration during development.
/**
* Convert with file system watching for development workflows.
* Automatically regenerates documentation when source files change.
* @param success - Callback executed after each successful conversion
* @returns Promise that never resolves (runs indefinitely)
*/
convertAndWatch(success: (project: ProjectReflection) => Promise<void>): Promise<never>;Usage Examples:
import { Application } from "typedoc";
const app = await Application.bootstrap({
entryPoints: ["src/"],
out: "docs",
});
// Watch for changes and regenerate docs
await app.convertAndWatch(async (project) => {
console.log(`Documentation updated: ${project.children?.length} modules`);
await app.generateDocs(project, "docs");
// Optional: Also update JSON output
await app.generateJson(project, "docs/api.json");
});Direct access to core TypeDoc components for advanced customization and plugin development.
interface Application {
/** Configuration options container */
readonly options: Options;
/** TypeScript to reflection converter */
readonly converter: Converter;
/** Documentation renderer */
readonly renderer: Renderer;
/** JSON serialization system */
readonly serializer: Serializer;
/** Internationalization support */
readonly internationalization: Internationalization;
/** Application logger */
readonly logger: Logger;
}The Application class handles various error conditions during documentation generation:
All errors are logged through the application's logger system and appropriate exit codes are set for CLI usage.
Install with Tessl CLI
npx tessl i tessl/npm-typedoc