Docs
File Options

File Options

Options that are used to configure how files are output.

—outputFileStrategy

💡
Determines how output files are generated.

Accepts either "members" or "modules". Defaults to "members".

TypeDoc creates documentation according to exports derived from the given --entryPointsStrategy TypeDoc configuration.

This option provides some flexibility as to how output files are generated.

It is also possible to further refine what members are exported to individual files with the membersWithOwnFile option.

The following keys are available:

“members”

Generates an individual file for each exported module member. This is the standard behavior of the HTML theme and the default setting of the plugin.

  ├── README.md
  ├── module-a/
  │   ├── classes/
  │   │   ├── ClassA.md
  │   │   └── ClassB.md
  │   └── functions/
  │   │   ├── FunctionA.md
  │   │   └── FunctionB.md
  └── module-b/
      └── classes/
          ├── ClassA.md
          └── ClassB.md

“modules”

Generates a single file for every Module or Namespace where all members are hoisted to a single module file. This creates a flat navigation structure and reduces the amount of files generated.

  ├── README.md
  ├── module-a.md
  └── module-b.md
typedoc.json
{
  "outputFileStrategy": "members"
}

—membersWithOwnFile

💡

Determines which members are exported to their own file when outputFileStrategy equals members.

Accepts an array of the following values "Enum" "Variable" "Function" "Class" "Interface" "TypeAlias".

This option is useful when only specific types of members should be exported to a single file.

Ignored when --outputFileStrategy is equal to "modules"

typedoc.json
{
  "membersWithOwnFile": ["Class", "Enum", "Interface"]
}

—flattenOutputFiles

💡
Flatten output files to a single directory.

Accepts a boolean value. Defaults to false.

By default output files are generated in a directory structure that mirrors the project’s module hierarchy including folders for member kinds eg classes, enums, functions etc.

This option will flatten the output files to a single directory as follows:

Default output:

  ├── README.md
  ├── module-a/
  │   ├── classes/
  │   │   ├── ClassA.md
  │   │   └── ClassB.md
  │   └── functions/
  │   │   ├── FunctionA.md
  │   │   └── FunctionB.md
  └── module-b/
      └── classes/
          ├── ClassA.md
          └── ClassB.md

Flattened output:

  ├── README.md
  ├── module-a.Class.ClassA.md
  ├── module-a.Class.ClassB.md
  ├── module-a.Function.functionA.md
  ├── module-a.Function.functionB.md
  ├── module-b.Class.ClassA.md
  └── module-b.Class.ClassB.md
typedoc.json
{
  "flattenOutputFiles": false
}

—fileExtension

💡

Specify the file extension for generated output files.

Accepts a string value. Defaults to ".md".

Typically Markdown files are recognised by the .md or .markdown file extensions..mdx maybe required for compatibility with certain Markdown parsers.

typedoc.json
{
  "fileExtension": ".mdx"
}

—entryFileName

💡
The file name of the entry page.

Accepts a string value. Defaults to "README".

The entryFileName in this context is the root page of the documentation and each module directory. This is essentially the equivalent to index.html for web pages.

README is recognised when browsing folders on repos and Wikis and is the plugin default. index might be more suitable for static site generators.

The content of root documentation file will be resolved in the following order:

  1. The value of the --entryModule option (if defined).
  2. The resolved Readme file (skipped if the --readme option is set to none).
  3. The documentation index page.
typedoc.json
{
  "entryFileName": "index"
}

—modulesFileName

💡

The file name of the separate modules / index page.

Accepts a string value. Defaults to "modules | packages | globals".

Please note this option is not applicable when --readme is set to “none” or --mergeReadme is set to “true”.

typedoc.json
{
  "modulesFileName": "documentation"
}

—entryModule

💡

The name of a module that should act as the root page for the documentation.

Accepts a string value. Defaults to "undefined".

This option can be used when the root page of the documentation should be a specific module (typically a module named index).

The module name should be specified (NOT the reference to the file name).

Please note a separate modules index page will not be generated, therefore would work better if navigation is present.

typedoc.json
{
  "entryModule": "index"
}

—excludeScopesInPaths

💡
Exclude writing @ scope directories in paths.

Accepts a boolean value. Defaults to false.

By default directories are split by scopes when generating file paths.

This option will remove reference to @scope in the path when generating files and directories. It does not affect the name of the package or module in the output.

The following will be the directory structure for packages named @scope/package-1 and @scope/package-2:

Output when set to false (default):

  └──@scope/
      ├── package-1/
      └── package-2/

Output when set to true:

  ├── package-1/
  └── package-2/

Ignored if flattenOutputFiles is set to true.

typedoc.json
{
  "excludeScopesInPaths": false
}

—mergeReadme

💡

Merges the resolved readme into the project index page.

Accepts a boolean value. Defaults to false.

By default when a readme file is resolved, a separate readme page is created. This option appends the index page to the readme so only a single root page is generated.

This option has no effect when --readme is set to "none".

typedoc.json
{
  "mergeReadme": false
}