Options

TypeDoc accepts most of the command line arguments that the TypeScript compiler accepts. All command line arguments that are passed in without a flag will be parsed as input files. Any options passed on the command line will override options set in a configuration file.

$ typedoc --out path/to/documentation/ path/to/typescript/project/index.ts

Configuration Options

These options control where TypeDoc reads its configuration from.

options

$ typedoc --options <filename>

Specify an option file that should be loaded. If not specified TypeDoc will look for typedoc.json and typedoc.js in the current directory. The JSON file should return an object whose keys are the option names. For example:

// typedoc.json
{
"$schema": "https://typedoc.org/schema.json",
"entryPoints": ["./src/index.ts", "./src/secondary-entry.ts"],
"out": "doc"
}

// typedoc.js
/**
* @type {import('typedoc').TypeDocOptions}
*/

module.exports = {
entryPoints: ["./src/index.ts", "./src/secondary-entry.ts"],
out: "doc"
}

Option files may also contain an extends key which specifies an additional file to be loaded before importing options from the current file. Paths will be resolved relative to the options file they are loaded from.

The $schema key is an optional property that will be ignored by TypeDoc, but can be used to get better autocomplete when editing a typedoc.json file in VSCode and other editors which support JSON Schemas.

tsconfig

$ typedoc --tsconfig </path/to/tsconfig.json>

Specify a tsconfig.json file that options should be read from. If not specified TypeDoc will look for tsconfig.json in the current directory and parent directories like tsc does.

When TypeDoc loads a tsconfig.json file, it also will read TypeDoc options declared under the typedocOptions key and look for a tsdoc.json file in the same directory to read the supported tags.

TypeDoc provides its default configuration for extension in typedoc/tsdoc.json. To add a custom block tag, try:

// tsdoc.json
{
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",
"extends": ["typedoc/tsdoc.json"],
"tagDefinitions": [
{
"tagName": "@myCustomTag",
"syntaxKind": "block"
}
]
}

compilerOptions

Used to selectively override compiler options for generating documentation. Values set with this option will override options read from tsconfig.json.

{
"compilerOptions": {
"strictNullChecks": false
}
}

Input Options

These options control what files TypeDoc processes to generate documentation and how the files are processed.

entryPoints

$ typedoc a b
# or
$ typedoc --entryPoints a --entryPoints b

Specifies the entry points to be documented by TypeDoc. TypeDoc will examine the exports of these files and create documentation according to the exports. Entry points can be handled in one of three ways, see --entryPointStrategy for details.

entryPointStrategy

$ typedoc --entryPointStrategy expand ./src

There are three possible options:

Option Behavior
resolve (default) Expects all entry points to be contained within the root level tsconfig project. If a directory is given, includes <directory>/index as the entry point.
expand Expects all entry points to be contained within the root level tsconfig project. If a directory is given, files within it are recursively expanded. Effectively, this will make a separate page for each individual TypeScript file. (This was the default behavior in v0.21.)
packages If your codebase is comprised of one or more npm packages, you can pass the paths to these packages and TypeDoc will attempt to determine entry points based on package.json's main property (with default value index.js) and if it wasn't found, based on types property. If any of the packages given are the root of an npm Workspace or a Yarn Workspace TypeDoc will find all the workspaces defined in the package.json. This mode requires sourcemaps in your JS entry points or that you specify the TypeDoc entry point in your package.json to tell TypeDoc where your entry point TypeScript source. Supports wildcard paths in the same fashion as those found in npm or Yarn workspaces. Find more details in monorepo guide

exclude

$ typedoc --exclude "**/*+(index|.spec|.e2e).ts"

Exclude files by the given pattern when a path is provided as source. This option is only used to remove files from consideration as entry points. Unlike TypeScript's exclude option, it cannot be used to exclude files from compilation. You may want to turn on TypeScript's --skipLibCheck if you have compilation errors originating in @types packages.

Supports minimatch patterns. In configuration files, this option accepts an array of patterns. On the command line, it may be specified multiple times to add multiple patterns. If an exported member from one of your entry points is located in an excluded file, it will be excluded from the documentation.

If entryPointStrategy is set to `packages, then you can specify package directories with this option to exclude from documentation.

externalPattern

$ typedoc --externalPattern 'lib/**/*.ts' --externalPattern 'external/**/*.ts'

Define patterns for extra files that should be considered external. Can be used along with --excludeExternals to remove external modules from the documentation.

excludeExternals

$ typedoc --excludeExternals

Prevent externally resolved TypeScript files from being documented. Defaults to false.

excludeNotDocumented

$ typedoc --excludeNotDocumented

Removes symbols from the generated documentation which do not have an associated doc comment.

excludeInternal

$ typedoc --excludeInternal

Removes symbols annotated with the @internal doc tag. Defaults to true if the stripInternal compiler option is set to true, otherwise defaults to false.

excludePrivate

$ typedoc --excludePrivate

Removes private class members from the generated documentation. Defaults to false.

excludeProtected

$ typedoc --excludeProtected

Removes protected class members from the generated documentation. Defaults to false.

externalSymbolLinkMappings

// typedoc.json
{
"externalSymbolLinkMappings": {
// {@link typescript!Partial} will use this link as well as
// type Foo = Partial<Bar>
"typescript": {
"Partial": "https://www.typescriptlang.org/docs/handbook/utility-types.html#partialtype"
}
}
}

Can be used to specify locations of externally defined types. If the external library uses namespaces, qualify the name with . as a separator. These definitions will be used for both types linked to by the user via a {@link} tag and in code.

TypeDoc assumes that if a symbol was referenced from a package, it was exported from that package. This will be true for most native TypeScript packages, but packages which rely on @types will be linked according to the @types package, not the original module name. If both are intended to be supported, both packages must be listed.

// typedoc.json
{
"externalSymbolLinkMappings": {
// used by `class Foo extends Component {}`
"@types/react": {
"Component": "https://reactjs.org/docs/react-component.html"
},
// used by {@link react!Component}
"react": {
"Component": "https://reactjs.org/docs/react-component.html"
}
}
}

Global external types are supported, but may have surprising behavior. Types which are defined in the TypeScript lib files (including Array, Promise, ...) will be detected as belonging to the typescript package rather than the special global package reserved for global types.

// typedoc.json
{
"externalSymbolLinkMappings": {
// used by {@link !Promise}
"global": {
"Promise": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"
},
// used by type Foo = Promise<string>
"typescript": {
"Promise": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise"
}
}
}

media

$ typedoc --media <path/to/media/>

Specifies a media directory that will be copied to the output file. Media can be linked to with media://file.jpg in doc comments.

includes

$ typedoc --includes <path/to/includes/>

Specifies a directory with files that can be injected into the generated documentation with [[include:file.md]] in a doc comment.

Output Options

These options control TypeDoc's output.

out

$ typedoc --out <path/to/documentation/>

Specifies the location the html documentation should be written to. The HTML output produced by running TypeDoc on itself can be seen at /api.

json

$ typedoc --json <path/to/out-file.json>

Specifies the location to output a JSON file containing all of the reflection data. An example of the JSON output from running TypeDoc on itself can be seen at /api/docs.json.

pretty

$ typedoc --json out.json --pretty

Tells TypeDoc to pretty-format the JSON output. Defaults to true.

emit

$ typedoc --emit none

Instructs TypeDoc to write compiled output files as tsc does.

Value Behavior
docs Emit documentation, but not JS (default).
both Emit both documentation and JS.
none Emit nothing, just convert and run validation.

Note: If you have your TypeScript configured with declaration: true (through tsconfig.json), the Typedoc emit both option will also generate type declaration files. This is because Typedoc falls back to TypeScript to generate the JS, this allows us to set the normal TypeScript options for type declarations and have Typedoc handle generating the docs, js, and types for us, all at once.

theme

$ typedoc --theme default

Specify the theme name that should be used. TypeDoc 0.22 contains architectural changes which breaks themes developed for TypeDoc 0.21 and earlier.

lightHighlightTheme / darkHighlightTheme

$ typedoc --darkHighlightTheme dark-plus

Specify the Shiki theme to be used to highlight code snippets in light/dark mode.

customCss

$ typedoc --customCss ./theme/style.css

Specifies an extra CSS file that should be copied into the assets directory and referenced by the theme.

markedOptions

Specifies the options that are forwarded to Marked when parsing doc comments. By default TypeDoc overrides the default values used by Marked with the ones shown below:

{
"markedOptions": {
"mangle": false
}
}

See the options section on the Marked site for a full list of available options.

name

$ typedoc --name <Documentation title>

Set the name of the project that will be used in the header of the template. The name defaults to the package name and current version according to your package.json.

includeVersion

$ typedoc --name "Name" --includeVersion

Adds the package version to the project's name. In this case, if the project was on version 1.2.3 according to package.json, this would generate documentation called "Name - v1.2.3"

disableSources

$ typedoc --disableSources

Disables the defined in text describing where a reflection was created.

basePath

$ typedoc --basePath ./ --entryPoints src/index.ts

Specifies the base path to be used when displaying file paths. If not set, TypeDoc will guess by taking the lowest common directory to all source files. In the above example, TypeDoc would display links to index.ts rather than src/index.ts.

Note: This option only affects displayed paths. It does not affect where TypeDoc will create links to.

excludeTags

$ typedoc --excludeTags apidefine

Specify tags that should be removed from doc comments when parsing. Useful if your project uses apiDoc for documenting RESTful web APIs.

readme

$ typedoc --readme <path/to/readme|none>

Path to the readme file that should be displayed on the index page. Pass none to disable the index page and start the documentation on the globals page.

cname

$ typedoc --cname typedoc.org

Create a CNAME file in the output directory with the specified text.

sourceLinkTemplate

$ typedoc --sourceLinkTemplate 'https://vcs.example.com/{path}?at={gitRevision}#line={line}'

Specify a link template to be used when generating source urls. If not set, will be automatically created using the git remote for GitHub, GitLab, and BitBucket urls. Supports {path}, {line}, and {gitRevision} placeholders.

gitRevision

$ typedoc --gitRevision <revision|branch>

Use specified revision or branch instead of the last revision for linking to source files. Defaults to the last commit.

gitRemote

$ typedoc --gitRemote <remote>

Use the specified git remote instead of origin for linking to source files in GitHub, Bitbucket, or GitLab. You can use git remote to view a list of valid remotes. If you are updating documentation for a forked package, you probably want to pass --gitRemote upstream.

(Deprecated, will be removed in 0.24) This may be set to a URL (staring with http:// or https://), in which case TypeDoc will assume that it is the base URL for links. Links will be created to {gitRemote}/{gitRevision}/{filePath}.

htmlLang

$ typedoc --htmlLang es

Sets the lang attribute in TypeDoc's HTML output, defaults to en, resulting in <html lang="en">.

githubPages

$ typedoc --githubPages false

When enabled, automatically add a .nojekyll file to the output directory to prevent GitHub Pages from processing your documentation site using Jekyll. If you have scoped packages, TypeDoc generates HTML files that start with _ which are ignored by Jekyll. Defaults to true.

gaID

$ typedoc --gaID

Set the Google Analytics tracking ID and activate tracking code.

hideGenerator

$ typedoc --hideGenerator

Do not print the TypeDoc link at the end of the page. Defaults to false.

searchInComments

$ typedoc --searchInComments

Enables searching comment text in the generated documentation site.

Note: Enabling this option will increase the size of your search index, potentially up to an order of magnitude larger in projects with many long comments.

cleanOutputDir

$ typedoc --cleanOutputDir false

Can be used to prevent TypeDoc from cleaning the output directory specified with --out.

$ typedoc --titleLink "http://example.com"

Sets the link the title in the header points to. Defaults to the documentation homepage.

// typedoc.json
{
"navigationLinks": {
"Example": "http://example.com"
}
}

Defines additional links to be included in the page header.

// typedoc.json
{
"sidebarLinks": {
"Example": "http://example.com"
}
}

Defines additional links to be included in the page sidebar.

Comment Options

commentStyle

$ typedoc --commentStyle block

Determines what comment types TypeDoc will use. Note: Writing non-JSDoc comments will cause poorer intellisense in VSCode and is therefore generally not recommended.

Value Behavior
jsdoc (default) Use block comments starting with /**
block Use all block comments
line Use // comments
all Use both block and line comments

blockTags

// typedoc.json
{
"blockTags": ["@param", "@returns"]
}

Override TypeDoc's supported block tags, emit warnings for any tags not listed here. This option will be set by tsdoc.json if present.

inlineTags

// typedoc.json
{
"inlineTags": ["@link"]
}

Override TypeDoc's supported inline tags, emit warnings for any tags not listed here. This option will be set by tsdoc.json if present.

modifierTags

// typedoc.json
{
"modifierTags": ["@hidden", "@packageDocumentation"]
}

Override TypeDoc's supported modifier tags, emit warnings for any tags not listed here. This option will be set by tsdoc.json if present.

Organization Options

categorizeByGroup

$ typedoc --categorizeByGroup false

This flag categorizes reflections by group (within properties, methods, etc). To allow methods and properties of the same category to be grouped together, set this flag to false. Defaults to true.

defaultCategory

$ typedoc --defaultCategory "Category Name"

Sets the name for the default category which is used when only some elements of the page are categorized. Defaults to 'Other'

categoryOrder

// typedoc.json
{
"categoryOrder": ["Category Name", "Other Category", "*"]
}

Array option which allows overriding the order categories display in. A string of * indicates where categories that are not in the list should appear.

By default, categories are displayed alphabetically. If unknown categories are found, they will be listed at the end by default.

sort

$ typedoc --sort static-first --sort alphabetical

Specifies the sort order for members. Sorting strategies will be applied in order. If an earlier sorting strategy determines the relative ordering of two reflections, later ordering strategies will not be applied.

For example, with the setting ["static-first", "visibility"], TypeDoc will first compare two reflections by if they are static or not, and if that comparison returns equal, will check the visibility of each reflection. On the other hand, if ["visibility", "static-first"] is specified, TypeDoc would sort all public properties first and then sort each group to put static properties first. This means that ["source-order", "static-first"] is equivalent to ["source-order"] since ordering by position in source will always produce a non-equal comparison.

The available sorting strategies are:

  • source-order (sorts by file, then by position in file)
  • alphabetical
  • enum-value-ascending (only applies to children of an enum)
  • enum-value-descending (only applies to children of an enum)
  • static-first
  • instance-first
  • visibility (public, then protected, then private)
  • required-first
  • kind (order according to the kindSortOrder option)

kindSortOrder

Specifies the relative ordering of reflections if kind is specified in the sort option. The default order is:

// typedoc.json
{
"kindSortOrder": [
"Reference",
"Project",
"Module",
"Namespace",
"Enum",
"EnumMember",
"Class",
"Interface",
"TypeAlias",
"Constructor",
"Property",
"Variable",
"Function",
"Accessor",
"Method",
"ObjectLiteral",
"Parameter",
"TypeParameter",
"TypeLiteral",
"CallSignature",
"ConstructorSignature",
"IndexSignature",
"GetSignature",
"SetSignature",
]
}

visibilityFilters

// typedoc.json
{
"visibilityFilters": {
"protected": false,
"private": false,
"inherited": true,
"external": false,
"@alpha": false,
"@beta": false
}
}

Specifies the available filters when viewing a page. The four protected, private, inherited, and external options are all shown by default. Their default value may be set, or they may be omitted from this option to disable that filter. Further, modifier tags may be specified to introduce a custom sort option based on a tag.

searchCategoryBoosts

// typedoc.json
{
"searchCategoryBoosts": {
"Common Items": 1.5
}
}

Configure the search to increase the relevance of items in a given category.

searchGroupBoosts

// typedoc.json
{
"searchCategoryBoosts": {
"Classes": 1.5
}
}

Configure the search to increase the relevance of items in a given group.

General Options

Options which don't fit elsewhere.

watch

$ typedoc --watch

Use TypeScript's incremental compiler to watch source files for changes and build the docs on change. May be combined with --emit.

Note: This mode will only detect changes to files watched by the TypeScript compiler. Changes to other files (README.md, imported files with --includes) will not cause a rebuild.

preserveWatchOutput

$ typedoc --watch --preserveWatchOutput

By default, --watch clears the screen between compilation steps. If --preserveWatchOutput is specified, this behavior is disabled.

help

$ typedoc --help

Print all available options, along with a short description. Also prints a list of supported highlighting languages.

version

$ typedoc --version

Prints TypeDoc's version.

showConfig

$ typedoc --showConfig

Print TypeDoc's config and exit. Useful for debugging what options have been set.

plugin

$ typedoc --plugin <none|plugin>

Specifies the plugins that should be loaded. By default, all installed npm packages with one of the following in their keywords will be loaded.

  • typedocplugin - Widest support, discouraged for plugins only supporting versions newer than 0.22.8.
  • typedoc-plugin - Replacement for typedocplugin, used for plugins which do more than just add a theme, introduced in 0.22.9.
  • typedoc-theme - Used for plugins which add a theme, and should show up on the Themes page, introduced in 0.22.9.

If this option is specified, automatic package discovery and loading will be disabled.

logger

$ typedoc --logger <none|Function>

Specifies the logger to write output to. When using TypeDoc programmatically, a function may be specified that will be called with the log message. By default, logs to the console. none may be passed to disable logging.

logLevel

$ typedoc --logLevel Verbose

Specifies the log level to be printed to the console. Defaults to Info. The available levels are:

  • Verbose - Print all log messages, may include debugging information intended for TypeDoc developers
  • Info - Print informational log messages along with warning and error messages
  • Warn - Print warning and error messages
  • Error - Print only error messages

skipErrorChecking

$ typedoc --skipErrorChecking

Instructs TypeDoc to not run the type checker before converting a project. Enabling this option may improve generation time, but could also result in crashes if your code contains type errors.

Validation

Options that control how TypeDoc validates your documentation

validation

$ typedoc --validation.invalidLink
$ typedoc --validation
{
"validation": {
"notExported": true,
"invalidLink": true,
"notDocumented": false
}
}

Specifies validation steps TypeDoc should perform on your generated documentation.

treatWarningsAsErrors

$ typedoc --treatWarningsAsErrors

Causes TypeDoc to treat any reported warnings as fatal errors that can prevent documentation from being generated.

intentionallyNotExported

Lists symbols which are intentionally excluded from the documentation output and should not produce warnings. Entries may optionally specify a file name before a colon to only suppress warnings for symbols declared in a specific file.

typedoc.json:

{
"intentionallyNotExported": ["InternalClass", "src/other.ts:OtherInternal"]
}

requiredToBeDocumented

Set the list of reflection types that must be documented, used by validation.notDocumented

typedoc.json:

{
"requiredToBeDocumented": ["Enum", "Class"]
}