Options
All
  • Public
  • Public/Protected
  • All
Menu

Maintains a collection of option declarations split into TypeDoc options and TypeScript options. Ensures options are of the correct type for calling code.

Option Discovery

Since plugins commonly add custom options, and TypeDoc does not permit options which have not been declared to be set, options must be read twice. The first time options are read, a noop logger is passed so that any errors are ignored. Then, after loading plugins, options are read again, this time with the logger specified by the application.

Options are read in a specific order.

  1. argv (0) - Must be read first since it should change the files read when passing --options or --tsconfig.
  2. typedoc-json (100) - Read next so that it can specify the tsconfig.json file to read.
  3. tsconfig-json (200) - Last config file reader, cannot specify the typedoc.json file to read.
  4. argv (300) - Read argv again since any options set there should override those set in config files.

Hierarchy

  • Options

Index

Constructors

constructor

  • new Options(logger: Logger): Options

Properties

Private _compilerOptions

_compilerOptions: CompilerOptions = {}

Private _declarations

_declarations: Map<string, Readonly<DeclarationOption>> = ...

Private _fileNames

_fileNames: readonly string[] = []

Private _logger

_logger: Logger

Private _projectReferences

_projectReferences: readonly ProjectReference[] = []

Private _readers

_readers: OptionsReader[] = []

Private _setOptions

_setOptions: Set<string> = ...

Private _values

_values: Record<string, unknown> = {}

Methods

addDeclaration

addDeclarations

  • Adds the given declarations to the container

    privateremarks

    This function explicitly provides a way out of the strict typing enforced by addDeclaration. It should only be used with careful validation of the declaration map. Internally, it is only used for adding TS options

    Parameters

    Returns void

addDefaultDeclarations

  • addDefaultDeclarations(): void

addReader

getCompilerOptions

  • getCompilerOptions(): CompilerOptions

getDeclaration

getDeclarations

Private getDefaultOptionValue

getFileNames

  • getFileNames(): readonly string[]

getProjectReferences

  • getProjectReferences(): readonly ProjectReference[]

getRawValues

getValue

  • getValue<K>(name: K): TypeDocOptionValues[K]
  • getValue(name: string): unknown

isDefault

  • isDefault(name: keyof TypeDocOptionMap): boolean
  • isDefault(name: string): boolean

isSet

read

  • read(logger: Logger): void

removeDeclarationByName

  • removeDeclarationByName(name: string): void
  • Removes a declared option. WARNING: This is probably a bad idea. If you do this you will probably cause a crash when code assumes that an option that it declared still exists.

    Parameters

    • name: string

    Returns void

removeReaderByName

  • removeReaderByName(name: string): void

reset

  • reset(): void

setCompilerOptions

  • setCompilerOptions(fileNames: readonly string[], options: CompilerOptions, projectReferences: undefined | readonly ProjectReference[]): void
  • Sets the compiler options that will be used to get a TS program.

    Parameters

    • fileNames: readonly string[]
    • options: CompilerOptions
    • projectReferences: undefined | readonly ProjectReference[]

    Returns void

setLogger

  • setLogger(logger: Logger): void

Private setOptionValueToDefault

setValue

  • setValue<K>(name: K, value: TypeDocOptions[K]): void
  • setValue(name: string, value: unknown): void

Generated using TypeDoc