or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

application.mdconfiguration.mdconverter.mdindex.mdinternationalization.mdmodels.mdoutput.mdserialization.md

application.mddocs/

0

# Application Management

1

2

Core application orchestration for TypeDoc documentation generation, including bootstrapping, plugin loading, configuration management, and conversion coordination.

3

4

## Capabilities

5

6

### Application Class

7

8

Main orchestrator for TypeDoc operations that manages all core components and coordinates the documentation generation process.

9

10

```typescript { .api }

11

/**

12

* The TypeDoc application orchestrates the entire documentation generation process.

13

* It manages converter, renderer, serializer, and other core components.

14

*/

15

class Application extends AbstractComponent<Application, ApplicationEvents> {

16

/** Options container with all configuration */

17

readonly options: Options;

18

/** Converter for TypeScript source to reflections */

19

readonly converter: Converter;

20

/** Renderer for generating output files */

21

readonly renderer: Renderer;

22

/** Serializer for JSON output */

23

readonly serializer: Serializer;

24

/** Internationalization support */

25

readonly internationalization: Internationalization;

26

/** Logger for application messages */

27

readonly logger: Logger;

28

29

/** Bootstrap application with basic options */

30

static bootstrap(options?: Partial<TypeDocOptions>): Promise<Application>;

31

32

/** Bootstrap application with plugins and option readers */

33

static bootstrapWithPlugins(

34

options: Partial<TypeDocOptions>,

35

readers: OptionsReader[]

36

): Promise<Application>;

37

38

/** Convert TypeScript source files to documentation model */

39

convert(): Promise<ProjectReflection | undefined>;

40

41

/** Convert with file system watching for development */

42

convertAndWatch(success: (project: ProjectReflection) => Promise<void>): Promise<never>;

43

44

/** Generate HTML documentation output */

45

generateDocs(project: ProjectReflection, out: string): Promise<void>;

46

47

/** Generate JSON documentation output */

48

generateJson(project: ProjectReflection, out: string): Promise<void>;

49

50

/** Validate project documentation completeness */

51

validate(project: ProjectReflection): void;

52

}

53

```

54

55

**Usage Examples:**

56

57

```typescript

58

import { Application } from "typedoc";

59

60

// Basic application setup

61

const app = await Application.bootstrap({

62

entryPoints: ["src/index.ts"],

63

out: "docs",

64

});

65

66

// Advanced setup with custom configuration

67

const app = await Application.bootstrapWithPlugins(

68

{

69

entryPoints: ["src/"],

70

entryPointStrategy: "expand",

71

out: "docs/api",

72

theme: "default",

73

excludeExternals: true,

74

categorizeByGroup: false,

75

},

76

[

77

new ArgumentsReader(0),

78

new TypeDocReader(),

79

new TSConfigReader(),

80

]

81

);

82

83

// Generate documentation

84

const project = await app.convert();

85

if (project) {

86

await app.generateDocs(project, "docs");

87

88

// Also generate JSON for custom processing

89

await app.generateJson(project, "docs/api.json");

90

91

// Validate documentation completeness

92

app.validate(project);

93

}

94

```

95

96

### Application Bootstrapping

97

98

Static methods for initializing TypeDoc applications with various configuration approaches.

99

100

```typescript { .api }

101

/**

102

* Bootstrap a TypeDoc application with simple options

103

* @param options - Partial configuration options

104

* @returns Promise resolving to configured Application instance

105

*/

106

static bootstrap(options?: Partial<TypeDocOptions>): Promise<Application>;

107

108

/**

109

* Bootstrap application with plugin loading and multiple option readers

110

* @param options - Base configuration options

111

* @param readers - Array of option readers for loading configuration

112

* @returns Promise resolving to fully configured Application instance

113

*/

114

static bootstrapWithPlugins(

115

options: Partial<TypeDocOptions>,

116

readers: OptionsReader[]

117

): Promise<Application>;

118

```

119

120

### Documentation Generation

121

122

Core methods for converting TypeScript source code to documentation and generating various output formats.

123

124

```typescript { .api }

125

/**

126

* Convert TypeScript source files to TypeDoc's reflection model

127

* @returns Promise resolving to ProjectReflection or undefined if conversion fails

128

*/

129

convert(): Promise<ProjectReflection | undefined>;

130

131

/**

132

* Convert with file system watching for development workflows

133

* @param success - Callback executed when conversion succeeds

134

* @returns Promise that never resolves (runs indefinitely)

135

*/

136

convertAndWatch(success: (project: ProjectReflection) => Promise<void>): Promise<never>;

137

138

/**

139

* Generate HTML documentation from project reflection

140

* @param project - The converted project reflection

141

* @param out - Output directory path

142

*/

143

generateDocs(project: ProjectReflection, out: string): Promise<void>;

144

145

/**

146

* Generate JSON output from project reflection

147

* @param project - The converted project reflection

148

* @param out - Output file path for JSON

149

*/

150

generateJson(project: ProjectReflection, out: string): Promise<void>;

151

152

/**

153

* Validate project documentation for completeness and issues

154

* @param project - The project reflection to validate

155

*/

156

validate(project: ProjectReflection): void;

157

```

158

159

### Application Events

160

161

Events dispatched during application lifecycle for plugin integration and custom processing.

162

163

```typescript { .api }

164

interface ApplicationEvents {

165

/** Fired when application bootstrap process completes */

166

BOOTSTRAP_END: [Application];

167

/** Fired when project is revived from JSON */

168

REVIVE: [ProjectReflection, JSONOutput.ProjectReflection];

169

}

170

```

171

172

**Usage Examples:**

173

174

```typescript

175

import { Application } from "typedoc";

176

177

const app = await Application.bootstrap();

178

179

// Listen for bootstrap completion

180

app.on("BOOTSTRAP_END", (app) => {

181

console.log("Application bootstrap completed");

182

console.log("Loaded plugins:", app.options.getValue("plugin"));

183

});

184

185

// Listen for project revival from JSON

186

app.on("REVIVE", (project, jsonProject) => {

187

console.log("Project revived:", project.name);

188

console.log("Original JSON version:", jsonProject.packageVersion);

189

});

190

```

191

192

### Watch Mode Operation

193

194

Development-friendly watching functionality for automatic regeneration during development.

195

196

```typescript { .api }

197

/**

198

* Convert with file system watching for development workflows.

199

* Automatically regenerates documentation when source files change.

200

* @param success - Callback executed after each successful conversion

201

* @returns Promise that never resolves (runs indefinitely)

202

*/

203

convertAndWatch(success: (project: ProjectReflection) => Promise<void>): Promise<never>;

204

```

205

206

**Usage Examples:**

207

208

```typescript

209

import { Application } from "typedoc";

210

211

const app = await Application.bootstrap({

212

entryPoints: ["src/"],

213

out: "docs",

214

});

215

216

// Watch for changes and regenerate docs

217

await app.convertAndWatch(async (project) => {

218

console.log(`Documentation updated: ${project.children?.length} modules`);

219

await app.generateDocs(project, "docs");

220

221

// Optional: Also update JSON output

222

await app.generateJson(project, "docs/api.json");

223

});

224

```

225

226

### Application Components Access

227

228

Direct access to core TypeDoc components for advanced customization and plugin development.

229

230

```typescript { .api }

231

interface Application {

232

/** Configuration options container */

233

readonly options: Options;

234

/** TypeScript to reflection converter */

235

readonly converter: Converter;

236

/** Documentation renderer */

237

readonly renderer: Renderer;

238

/** JSON serialization system */

239

readonly serializer: Serializer;

240

/** Internationalization support */

241

readonly internationalization: Internationalization;

242

/** Application logger */

243

readonly logger: Logger;

244

}

245

```

246

247

## Error Handling

248

249

The Application class handles various error conditions during documentation generation:

250

251

- **Conversion Errors**: TypeScript compilation failures, missing entry points, invalid configuration

252

- **Generation Errors**: File system permissions, invalid output paths, theme loading failures

253

- **Validation Errors**: Missing documentation, broken links, invalid references

254

- **Plugin Errors**: Plugin loading failures, incompatible versions, conflicting configurations

255

256

All errors are logged through the application's logger system and appropriate exit codes are set for CLI usage.