typedoc
- Version 0.27.6
- Published
- 1.92 MB
- 5 dependencies
- Apache-2.0 license
Install
npm i typedoc
yarn add typedoc
pnpm add typedoc
Overview
Create api documentation for TypeScript projects.
Index
Variables
Functions
Classes
Application
- bootstrap()
- bootstrapWithPlugins()
- convert()
- convertAndWatch()
- converter
- deserializer
- entryPoints
- entryPointStrategy
- EVENT_BOOTSTRAP_END
- EVENT_PROJECT_REVIVE
- EVENT_VALIDATE_PROJECT
- files
- generateDocs()
- generateJson()
- generateOutputs()
- getDefinedEntryPoints()
- getEntryPoints()
- getTypeScriptPath()
- getTypeScriptVersion()
- i18n
- internationalization
- lang
- logger
- options
- outputs
- renderer
- serializer
- skipErrorChecking
- toString()
- validate()
- VERSION
Comment
- blockTags
- clone()
- cloneDisplayParts()
- combineDisplayParts()
- deserializeDisplayParts()
- fromObject()
- getIdentifiedTag()
- getShortSummary()
- getTag()
- getTags()
- hasModifier()
- hasVisibleComponent()
- inheritedFromParentDeclaration
- label
- modifierTags
- removeModifier()
- removeTags()
- serializeDisplayParts()
- similarTo()
- sourcePath
- splitPartsToHeaderAndBody()
- summary
- toObject()
Context
- addChild()
- checker
- converter
- convertingClassOrInterface
- convertingTypeNode
- createDeclarationReflection()
- expectSymbolAtLocation()
- finalizeDeclarationReflection()
- getComment()
- getFileComment()
- getJsDocComment()
- getNodeComment()
- getSignatureComment()
- getSymbolAtLocation()
- getTypeAtLocation()
- i18n
- postReflectionCreation()
- program
- programs
- project
- registerReflection()
- resolveAliasedSymbol()
- scope
- shouldBeStatic
- shouldIgnore()
- withScope()
Converter
- addUnknownSymbolResolver()
- commentStyle
- config
- convert()
- EVENT_BEGIN
- EVENT_CREATE_DECLARATION
- EVENT_CREATE_DOCUMENT
- EVENT_CREATE_PARAMETER
- EVENT_CREATE_PROJECT
- EVENT_CREATE_SIGNATURE
- EVENT_CREATE_TYPE_PARAMETER
- EVENT_END
- EVENT_RESOLVE
- EVENT_RESOLVE_BEGIN
- EVENT_RESOLVE_END
- excludeExternals
- excludeNotDocumented
- excludePrivate
- excludeProtected
- excludeReferences
- externalPattern
- externalSymbolLinkMappings
- maxTypeConversionDepth
- parseRawComment()
- preserveLinkText
- processDocumentTags()
- resolveLinks()
- validation
DeclarationReflection
- defaultValue
- extendedBy
- extendedTypes
- fromObject()
- getAllSignatures()
- getChildOrTypePropertyByName()
- getNonIndexSignatures()
- getProperties()
- getSignature
- hasGetterOrSetter()
- implementationOf
- implementedBy
- implementedTypes
- indexSignatures
- inheritedFrom
- isDeclaration()
- overwrites
- packageVersion
- readme
- relevanceBoost
- setSignature
- signatures
- sources
- toObject()
- toString()
- traverse()
- type
- typeHierarchy
- typeParameters
- variant
DefaultThemeRenderContext
- breadcrumb
- commentShortSummary
- commentSummary
- commentTags
- defaultLayout
- displayParts
- documentTemplate
- footer
- getNavigation
- getReflectionClasses
- header
- hierarchy
- hierarchyTemplate
- hook
- i18n
- icons
- index
- indexTemplate
- internationalization
- markdown
- member
- memberDeclaration
- memberGetterSetter
- members
- memberSignatureBody
- memberSignatures
- memberSignatureTitle
- memberSources
- moduleMemberSummary
- moduleReflection
- navigation
- options
- page
- pageNavigation
- pageSidebar
- reflectionFlags
- reflectionPreview
- reflectionTemplate
- relativeURL
- settings
- sidebar
- sidebarLinks
- slugger
- theme
- toolbar
- type
- typeAndParent
- typeDeclaration
- typeDetails
- typeDetailsIfUseful
- typeParameters
- urlTo
Reflection
- anchor
- comment
- flags
- fromObject()
- getChildByName()
- getFriendlyFullName()
- getFullName()
- hasComment()
- hasGetterOrSetter()
- hasOwnDocument
- id
- isDeclaration()
- isDeprecated()
- isDocument()
- isParameter()
- isProject()
- isReference()
- kind
- kindOf()
- name
- parent
- project
- setFlag()
- toObject()
- toString()
- toStringHierarchy()
- traverse()
- url
- variant
- visit()
Interfaces
TypeDocOptionMap
- alwaysCreateEntryPointModule
- basePath
- blockTags
- cacheBust
- cascadedModifierTags
- categorizeByGroup
- categoryOrder
- cleanOutputDir
- cname
- commentStyle
- compilerOptions
- customCss
- customFooterHtml
- customFooterHtmlDisableWrapper
- customJs
- darkHighlightTheme
- defaultCategory
- disableGit
- disableSources
- emit
- entryPoints
- entryPointStrategy
- exclude
- excludeCategories
- excludeExternals
- excludeInternal
- excludeNotDocumented
- excludeNotDocumentedKinds
- excludePrivate
- excludeProtected
- excludeReferences
- excludeTags
- externalPattern
- externalSymbolLinkMappings
- favicon
- githubPages
- gitRemote
- gitRevision
- groupOrder
- groupReferencesByType
- headings
- help
- hideGenerator
- highlightLanguages
- hostedBaseUrl
- html
- ignoredHighlightLanguages
- includeHierarchySummary
- includeVersion
- inlineTags
- intentionallyNotExported
- jsDocCompatibility
- json
- kindSortOrder
- lang
- lightHighlightTheme
- locales
- logLevel
- markdownItLoader
- markdownItOptions
- markdownLinkExternal
- maxTypeConversionDepth
- modifierTags
- name
- navigation
- navigationLeaves
- navigationLinks
- notRenderedTags
- options
- out
- outputs
- packageOptions
- plugin
- preserveLinkText
- preserveWatchOutput
- pretty
- projectDocuments
- readme
- requiredToBeDocumented
- searchCategoryBoosts
- searchGroupBoosts
- searchInComments
- searchInDocuments
- showConfig
- sidebarLinks
- skipErrorChecking
- sluggerConfiguration
- sort
- sortEntryPoints
- sourceLinkExternal
- sourceLinkTemplate
- suppressCommentWarningsInDeclarationFiles
- theme
- titleLink
- treatValidationWarningsAsErrors
- treatWarningsAsErrors
- tsconfig
- typePrintWidth
- useFirstParagraphOfCommentAsSummary
- useHostedBaseUrlForAbsoluteLinks
- useTsLinkResolution
- validation
- version
- visibilityFilters
- watch
Enums
Type Aliases
- CommentDisplayPart
- CommentStyle
- DeclarationOption
- DeclarationOptionToOptionType
- EntryPointStrategy
- EnumKeys
- ExternalResolveResult
- ExternalSymbolResolver
- JsDocCompatibility
- KeyToDeclaration
- ManuallyValidatedOption
- MeaningKeyword
- OutputSpecification
- ReflectionId
- ReflectionSymbolIdString
- ReflectionVisitor
- RenderTemplate
- SomeReflection
- SomeType
- SortStrategy
- TypeContext
- TypeDocOptions
- TypeDocOptionValues
- TypeKind
- TypeVisitor
- ValidationOptions
- VarianceModifier
Namespaces
Configuration
- ArgumentsReader
- ArrayDeclarationOption
- BooleanDeclarationOption
- CommentStyle
- CommentStyle
- DeclarationOption
- DeclarationOptionBase
- DeclarationOptionToOptionType
- EmitStrategy
- EmitStrategy
- FlagsDeclarationOption
- JsDocCompatibility
- KeyToDeclaration
- ManuallyValidatedOption
- MapDeclarationOption
- MixedDeclarationOption
- NumberDeclarationOption
- ObjectDeclarationOption
- Option()
- Options
- OptionsReader
- OutputSpecification
- PackageJsonReader
- ParameterHint
- ParameterType
- ParameterTypeToOptionTypeMap
- StringDeclarationOption
- TSConfigReader
- TypeDocOptionMap
- TypeDocOptions
- TypeDocOptionValues
- TypeDocReader
- ValidationOptions
JSONOutput
- ArrayType
- Comment
- CommentDisplayPart
- CommentTag
- ConditionalType
- ContainerReflection
- DeclarationReflection
- DocumentReflection
- FileRegistry
- IndexedAccessType
- InferredType
- InlineTagDisplayPart
- IntersectionType
- IntrinsicType
- LiteralType
- MappedType
- ModelToObject
- NamedTupleMemberType
- OptionalType
- ParameterReflection
- PredicateType
- ProjectReflection
- QueryType
- ReferenceReflection
- ReferenceType
- Reflection
- ReflectionCategory
- ReflectionFlags
- ReflectionGroup
- ReflectionSymbolId
- ReflectionType
- ReflectionVariantMap
- RelativeLinkDisplayPart
- RestType
- SignatureReflection
- SomeReflection
- SomeType
- SourceReference
- TemplateLiteralType
- TupleType
- Type
- TypeKindMap
- TypeOperatorType
- TypeParameterReflection
- UnionType
- UnknownType
Models
- ArrayType
- Comment
- CommentDisplayPart
- CommentTag
- ConditionalType
- ContainerReflection
- DeclarationHierarchy
- DeclarationReflection
- DocumentReflection
- FileRegistry
- IndexedAccessType
- InferredType
- InlineTagDisplayPart
- IntersectionType
- IntrinsicType
- LiteralType
- makeRecursiveVisitor()
- MappedType
- NamedTupleMember
- OptionalType
- ParameterReflection
- PredicateType
- ProjectReflection
- QueryType
- ReferenceReflection
- ReferenceType
- Reflection
- ReflectionCategory
- ReflectionFlag
- ReflectionFlags
- ReflectionGroup
- ReflectionId
- ReflectionKind
- ReflectionSymbolId
- ReflectionSymbolIdString
- ReflectionType
- ReflectionVariant
- ReflectionVisitor
- RelativeLinkDisplayPart
- RestType
- SignatureReflection
- SomeReflection
- SomeType
- SourceReference
- splitUnquotedString()
- TemplateLiteralType
- TraverseCallback
- TraverseProperty
- TupleType
- Type
- TypeContext
- TypeContext
- TypeKind
- TypeKindMap
- TypeOperatorType
- TypeParameterReflection
- TypeVisitor
- UnionType
- UnknownType
- ValidatingFileRegistry
- VarianceModifier
- VarianceModifier
Variables
variable CommentStyle
const CommentStyle: { readonly JSDoc: 'jsdoc'; readonly Block: 'block'; readonly Line: 'line'; readonly All: 'all';};
Determines how TypeDoc searches for comments.
variable EntryPointStrategy
const EntryPointStrategy: { readonly Resolve: 'resolve'; readonly Expand: 'expand'; readonly Packages: 'packages'; readonly Merge: 'merge';};
Defines how entry points are interpreted.
variable TypeContext
const TypeContext: { readonly none: 'none'; readonly templateLiteralElement: 'templateLiteralElement'; readonly arrayElement: 'arrayElement'; readonly indexedAccessElement: 'indexedAccessElement'; readonly conditionalCheck: 'conditionalCheck'; readonly conditionalExtends: 'conditionalExtends'; readonly conditionalTrue: 'conditionalTrue'; readonly conditionalFalse: 'conditionalFalse'; readonly indexedIndex: 'indexedIndex'; readonly indexedObject: 'indexedObject'; readonly inferredConstraint: 'inferredConstraint'; readonly intersectionElement: 'intersectionElement'; readonly mappedName: 'mappedName'; readonly mappedParameter: 'mappedParameter'; readonly mappedTemplate: 'mappedTemplate'; readonly optionalElement: 'optionalElement'; readonly predicateTarget: 'predicateTarget'; readonly queryTypeTarget: 'queryTypeTarget'; readonly typeOperatorTarget: 'typeOperatorTarget'; readonly referenceTypeArgument: 'referenceTypeArgument'; readonly restElement: 'restElement'; readonly tupleElement: 'tupleElement'; readonly unionElement: 'unionElement';};
Enumeration that can be used when traversing types to track the location of recursion. Used by TypeDoc internally to track when to output parenthesis when rendering.
variable VarianceModifier
const VarianceModifier: { readonly in: 'in'; readonly out: 'out'; readonly inOut: 'in out';};
Modifier flags for type parameters, added in TS 4.7
Functions
function makeRecursiveVisitor
makeRecursiveVisitor: (visitor: Partial<TypeVisitor>) => TypeVisitor;
function normalizePath
normalizePath: (path: string) => string;
Normalize the given path.
Parameter path
The path that should be normalized.
Returns
The normalized path.
function Option
Option: <K extends keyof TypeDocOptionMap>( name: K) => ( _: unknown, _context: ClassAccessorDecoratorContext< { application: Application } | { options: Options }, TypeDocOptionValues[K] >) => { get( this: { application: Application } | { options: Options } ): TypeDocOptionValues[K]; set(_value: never): never;};
Binds an option to an accessor. Does not register the option.
Note: This is a standard ES decorator. It will not work with pre-TS 5.0 experimental decorators enabled.
function resetReflectionID
resetReflectionID: () => void;
Reset the reflection id.
Used by the test cases to ensure the reflection ids won't change between runs.
function splitUnquotedString
splitUnquotedString: (input: string, delimiter: string) => string[];
Classes
class Application
class Application extends AbstractComponent<Application, ApplicationEvents> {}
The default TypeDoc main application class.
This class holds the two main components of TypeDoc, the Converter and the Renderer. When running TypeDoc, first the Converter is invoked which generates a ProjectReflection from the passed in source files. The ProjectReflection is a hierarchical model representation of the TypeScript project. Afterwards the model is passed to the Renderer which uses an instance of Theme to generate the final documentation.
Both the Converter and the Renderer emit a series of events while processing the project. Subscribe to these Events to control the application flow or alter the output.
Remarks
Access to an Application instance can be retrieved with Application.bootstrap or Application.bootstrapWithPlugins. It can not be constructed manually.
Common Root level class which contains most useful behavior.
property converter
converter: Converter;
The converter used to create the declaration reflections.
property deserializer
deserializer: Deserializer;
The deserializer used to restore previously serialized JSON output.
property entryPoints
entryPoints: string[];
property entryPointStrategy
entryPointStrategy: EntryPointStrategy;
property EVENT_BOOTSTRAP_END
static readonly EVENT_BOOTSTRAP_END: string;
Emitted after plugins have been loaded and options have been read, but before they have been frozen. The listener will be given an instance of Application.
property EVENT_PROJECT_REVIVE
static readonly EVENT_PROJECT_REVIVE: string;
Emitted after a project has been deserialized from JSON. The listener will be given an instance of ProjectReflection.
property EVENT_VALIDATE_PROJECT
static readonly EVENT_VALIDATE_PROJECT: string;
Emitted when validation is being run. The listener will be given an instance of ProjectReflection.
property files
files: FileRegistry;
property i18n
i18n: TranslationProxy;
Proxy based shortcuts for internationalization keys.
property internationalization
internationalization: Internationalization;
Internationalization module which supports translating according to the
lang
option.
property lang
lang: string;
property logger
logger: Logger;
The logger that should be used to output messages.
property options
options: Options;
property outputs
outputs: Outputs;
property renderer
renderer: Renderer;
The renderer used to generate the HTML documentation output.
property serializer
serializer: Serializer;
The serializer used to generate JSON output.
property skipErrorChecking
skipErrorChecking: boolean;
property VERSION
static readonly VERSION: string;
The version number of TypeDoc.
method bootstrap
static bootstrap: ( options?: Partial<TypeDocOptions>, readers?: readonly OptionsReader[]) => Promise<Application>;
Initialize TypeDoc without loading plugins.
Parameter options
Options to set during initialization
Parameter readers
Option readers to use to discover options from config files.
Example 1
Initialize the application with pretty-printing output disabled.
const app = Application.bootstrap({ pretty: false });
method bootstrapWithPlugins
static bootstrapWithPlugins: ( options?: Partial<TypeDocOptions>, readers?: readonly OptionsReader[]) => Promise<Application>;
Initialize TypeDoc, loading plugins if applicable.
method convert
convert: () => Promise<ProjectReflection | undefined>;
Run the converter for the given set of files and return the generated reflections.
Returns
An instance of ProjectReflection on success, undefined otherwise.
method convertAndWatch
convertAndWatch: ( success: (project: ProjectReflection) => Promise<void>) => void;
method generateDocs
generateDocs: (project: ProjectReflection, out: string) => Promise<void>;
Render HTML for the given project
method generateJson
generateJson: (project: ProjectReflection, out: string) => Promise<void>;
Write the reflections to a json file.
Parameter out
The path and file name of the target file.
Returns
Whether the JSON file could be written successfully.
method generateOutputs
generateOutputs: (project: ProjectReflection) => Promise<void>;
Render outputs selected with options for the specified project
method getDefinedEntryPoints
getDefinedEntryPoints: () => DocumentationEntryPoint[] | undefined;
Gets the entry points to be documented according to the current
entryPoints
andentryPointStrategy
options. May return undefined if entry points fail to be expanded.
method getEntryPoints
getEntryPoints: () => DocumentationEntryPoint[] | undefined;
method getTypeScriptPath
getTypeScriptPath: () => string;
Return the path to the TypeScript compiler.
method getTypeScriptVersion
getTypeScriptVersion: () => string;
method toString
toString: () => string;
Print the version number.
method validate
validate: (project: ProjectReflection) => void;
class ArgumentsReader
class ArgumentsReader implements OptionsReader {}
Obtains option values from command-line arguments
constructor
constructor(priority: number, args?: string[]);
property name
readonly name: string;
property order
readonly order: number;
property supportsPackages
readonly supportsPackages: boolean;
method read
read: (container: Options, logger: Logger) => void;
class ArrayType
class ArrayType extends Type {}
Represents an array type.
let value: string[];Types
constructor
constructor(elementType: SomeType);
Parameter elementType
The type of the elements in the array.
property elementType
elementType: SomeType;
property type
readonly type: string;
method getTypeString
protected getTypeString: () => string;
method needsParenthesis
needsParenthesis: () => boolean;
method toObject
toObject: (serializer: Serializer) => JSONOutput.ArrayType;
class Comment
class Comment {}
A model that represents a comment.
Instances of this model are created by the CommentPlugin. You can retrieve comments through the DeclarationReflection.comment property. Comments
constructor
constructor( summary?: CommentDisplayPart[], blockTags?: CommentTag[], modifierTags?: Set<`@${string}`>);
Creates a new Comment instance.
property blockTags
blockTags: CommentTag[];
All associated block level tags.
property inheritedFromParentDeclaration
inheritedFromParentDeclaration?: boolean;
If the comment was inherited from a different "parent" declaration (see #2545), then it is desirable to know this as any
@param
tags which do not apply should not cause warnings. This is not serialized, and only set when the comment was created from ats.CommentRange
.
property label
label?: string;
Label associated with this reflection, if any (https://tsdoc.org/pages/tags/label/)
property modifierTags
modifierTags: Set<`@${string}`>;
All modifier tags present on the comment, e.g.
@alpha
,@beta
.
property sourcePath
sourcePath?: string;
Full path to the file where this comment originated from, if any. This field will not be serialized, so will not be present when handling JSON-revived reflections.
Note: This field is non-enumerable to make testing comment contents with
deepEqual
easier.
property summary
summary: CommentDisplayPart[];
The content of the comment which is not associated with a block tag.
method clone
clone: () => Comment;
Create a deep clone of this comment.
method cloneDisplayParts
static cloneDisplayParts: ( parts: readonly CommentDisplayPart[]) => CommentDisplayPart[];
Helper utility to clone Comment.summary or CommentTag.content
method combineDisplayParts
static combineDisplayParts: ( parts: readonly CommentDisplayPart[] | undefined) => string;
Debugging utility for combining parts into a simple string. Not suitable for rendering, but can be useful in tests.
method deserializeDisplayParts
static deserializeDisplayParts: ( de: Deserializer, parts: JSONOutput.CommentDisplayPart[]) => CommentDisplayPart[];
method fromObject
fromObject: (de: Deserializer, obj: JSONOutput.Comment) => void;
method getIdentifiedTag
getIdentifiedTag: ( identifier: string, tagName: `@${string}`) => CommentTag | undefined;
method getShortSummary
getShortSummary: (useFirstParagraph: boolean) => readonly CommentDisplayPart[];
Gets either the
@summary
tag, or a short version of the comment summary section for rendering in module/namespace pages.
method getTag
getTag: (tagName: `@${string}`) => CommentTag | undefined;
Return the first tag with the given name.
Parameter tagName
The name of the tag to look for.
Returns
The found tag or undefined.
method getTags
getTags: (tagName: `@${string}`) => CommentTag[];
Get all tags with the given tag name.
method hasModifier
hasModifier: (tagName: `@${string}`) => boolean;
Test whether this comment contains a tag with the given name.
Parameter tagName
The name of the tag to look for.
Returns
TRUE when this comment contains a tag with the given name, otherwise FALSE.
method hasVisibleComponent
hasVisibleComponent: () => boolean;
Has this comment a visible component?
Returns
TRUE when this comment has a visible component.
method removeModifier
removeModifier: (tagName: `@${string}`) => void;
method removeTags
removeTags: (tagName: `@${string}`) => void;
Removes all block tags with the given tag name from the comment.
Parameter tagName
method serializeDisplayParts
static serializeDisplayParts: { ( serializer: Serializer, parts: CommentDisplayPart[] ): JSONOutput.CommentDisplayPart[]; ( serializer: Serializer, parts: CommentDisplayPart[] ): JSONOutput.CommentDisplayPart[];};
no point in showing this signature in api docs
method similarTo
similarTo: (other: Comment) => boolean;
Checks if this comment is roughly equal to the other comment. This isn't exactly equal, but just "roughly equal" by the comment text.
method splitPartsToHeaderAndBody
static splitPartsToHeaderAndBody: (parts: readonly CommentDisplayPart[]) => { header: string; body: CommentDisplayPart[];};
Splits the provided parts into a header (first line, as a string) and body (remaining lines). If the header line contains inline tags they will be serialized to a string.
method toObject
toObject: (serializer: Serializer) => JSONOutput.Comment;
class CommentTag
class CommentTag {}
A model that represents a single TypeDoc comment tag.
Tags are stored in the Comment.blockTags property. Comments
constructor
constructor(tag: string, text: CommentDisplayPart[]);
Create a new CommentTag instance.
property content
content: CommentDisplayPart[];
The actual body text of this tag.
property name
name?: string;
Some tags, (
@typedef
,@param
,@property
, etc.) may have a user defined identifier associated with them. If this tag is one of those, it will be parsed out and included here.
property skipRendering
skipRendering: boolean;
A flag which may be set by plugins to prevent TypeDoc from rendering this tag, if the plugin provides custom rendering. Note: This flag is **not** serialized, it is expected to be set just before the comment is rendered.
property tag
tag: string;
The name of this tag, e.g.
@returns
,@example
method clone
clone: () => CommentTag;
method fromObject
fromObject: (de: Deserializer, obj: JSONOutput.CommentTag) => void;
method similarTo
similarTo: (other: CommentTag) => boolean;
Checks if this block tag is roughly equal to the other tag. This isn't exactly equal, but just "roughly equal" by the tag text.
method toObject
toObject: (serializer: Serializer) => JSONOutput.CommentTag;
class ConditionalType
class ConditionalType extends Type {}
Represents a conditional type.
let value: Check extends Extends ? True : False;Types
constructor
constructor( checkType: SomeType, extendsType: SomeType, trueType: SomeType, falseType: SomeType);
property checkType
checkType: SomeType;
property extendsType
extendsType: SomeType;
property falseType
falseType: SomeType;
property trueType
trueType: SomeType;
property type
readonly type: string;
method getTypeString
protected getTypeString: () => string;
method needsParenthesis
needsParenthesis: (context: TypeContext) => boolean;
method toObject
toObject: (serializer: Serializer) => JSONOutput.ConditionalType;
class ContainerReflection
abstract class ContainerReflection extends Reflection {}
Reflections
property categories
categories?: ReflectionCategory[];
All children grouped by their category.
property children
children?: DeclarationReflection[];
The children of this reflection. Do not add reflections to this array manually. Instead call addChild.
property childrenIncludingDocuments
childrenIncludingDocuments?: (DeclarationReflection | DocumentReflection)[];
property documents
documents?: DocumentReflection[];
Documents associated with this reflection.
These are not children as including them as children requires code handle both types, despite being mostly unrelated and handled separately.
Including them here in a separate array neatly handles that problem, but also introduces another one for rendering. When rendering, documents should really actually be considered part of the "children" of a reflection. For this reason, we also maintain a list of child declarations with child documents which is used when rendering.
property groups
groups?: ReflectionGroup[];
All children grouped by their kind.
method addChild
addChild: (child: DeclarationReflection | DocumentReflection) => void;
method fromObject
fromObject: (de: Deserializer, obj: JSONOutput.ContainerReflection) => void;
method getChildrenByKind
getChildrenByKind: (kind: ReflectionKind) => DeclarationReflection[];
Return a list of all children of a certain kind.
Parameter kind
The desired kind of children.
Returns
An array containing all children with the desired kind.
method removeChild
removeChild: (child: DeclarationReflection | DocumentReflection) => void;
method toObject
toObject: (serializer: Serializer) => JSONOutput.ContainerReflection;
method traverse
traverse: (callback: TraverseCallback) => void;
class Context
class Context {}
The context describes the current state the converter is in.
property checker
readonly checker: ts.TypeChecker;
The TypeChecker instance returned by the TypeScript compiler.
property converter
readonly converter: Converter;
The converter instance that has created the context.
property convertingClassOrInterface
convertingClassOrInterface: boolean;
property convertingTypeNode
convertingTypeNode: boolean;
property i18n
readonly i18n: TranslationProxy;
Translation interface for log messages.
property program
readonly program: ts.Program;
The program currently being converted. Accessing this property will throw if a source file is not currently being converted.
property programs
readonly programs: readonly ts.Program[];
All programs being converted.
property project
readonly project: ProjectReflection;
The project that is currently processed.
property scope
readonly scope: Reflection;
The scope or parent reflection that is currently processed.
property shouldBeStatic
shouldBeStatic: boolean;
method addChild
addChild: (reflection: DeclarationReflection | DocumentReflection) => void;
method createDeclarationReflection
createDeclarationReflection: ( kind: ReflectionKind, symbol: ts.Symbol | undefined, exportSymbol: ts.Symbol | undefined, nameOverride?: string) => DeclarationReflection;
method expectSymbolAtLocation
expectSymbolAtLocation: (node: ts.Node) => ts.Symbol;
method finalizeDeclarationReflection
finalizeDeclarationReflection: (reflection: DeclarationReflection) => void;
method getComment
getComment: ( symbol: ts.Symbol, kind: ReflectionKind) => import('../models/index.js').Comment | undefined;
method getFileComment
getFileComment: ( node: ts.SourceFile) => import('../models/index.js').Comment | undefined;
method getJsDocComment
getJsDocComment: ( declaration: | ts.JSDocPropertyLikeTag | ts.JSDocCallbackTag | ts.JSDocTypedefTag | ts.JSDocTemplateTag | ts.JSDocEnumTag) => import('../models/index.js').Comment | undefined;
method getNodeComment
getNodeComment: ( node: ts.Node, moduleComment: boolean) => import('../models/index.js').Comment | undefined;
method getSignatureComment
getSignatureComment: ( declaration: ts.SignatureDeclaration | ts.JSDocSignature) => import('../models/index.js').Comment | undefined;
method getSymbolAtLocation
getSymbolAtLocation: (node: ts.Node) => ts.Symbol | undefined;
method getTypeAtLocation
getTypeAtLocation: (node: ts.Node) => ts.Type | undefined;
Return the type declaration of the given node.
Parameter node
The TypeScript node whose type should be resolved.
Returns
The type declaration of the given node.
method postReflectionCreation
postReflectionCreation: ( reflection: Reflection, symbol: ts.Symbol | undefined, exportSymbol: ts.Symbol | undefined) => void;
method registerReflection
registerReflection: ( reflection: Reflection, symbol: ts.Symbol | undefined) => void;
Register a newly generated reflection. All created reflections should be passed to this method to ensure that the project helper functions work correctly.
Parameter reflection
The reflection that should be registered.
Parameter symbol
The symbol the given reflection was resolved from.
method resolveAliasedSymbol
resolveAliasedSymbol: (symbol: ts.Symbol) => ts.Symbol;
method shouldIgnore
shouldIgnore: (symbol: ts.Symbol) => boolean;
method withScope
withScope: (scope: Reflection) => Context;
class Converter
class Converter extends AbstractComponent<Application, ConverterEvents> {}
Compiles source files using TypeScript and converts compiler symbols to reflections.
Common Responsible for converting TypeScript symbols into Reflections and Types.
constructor
constructor(owner: Application);
property commentStyle
commentStyle: CommentStyle;
property config
readonly config: CommentParserConfig;
property EVENT_BEGIN
static readonly EVENT_BEGIN: string;
Triggered when the converter begins converting a project. The listener will be given a Context object.
property EVENT_CREATE_DECLARATION
static readonly EVENT_CREATE_DECLARATION: string;
Triggered when the converter has created a declaration reflection. The listener will be given Context and a Models.DeclarationReflection.
property EVENT_CREATE_DOCUMENT
static readonly EVENT_CREATE_DOCUMENT: string;
Triggered when the converter has created a document reflection. The listener will be given
undefined
(for consistency with the other create events) and a Models.DocumentReflection.
property EVENT_CREATE_PARAMETER
static readonly EVENT_CREATE_PARAMETER: string;
Triggered when the converter has created a parameter reflection. The listener will be given Context, Models.ParameterReflection and a
ts.Node?
property EVENT_CREATE_PROJECT
static readonly EVENT_CREATE_PROJECT: string;
Triggered when the converter has created a project reflection. The listener will be given Context and a Models.ProjectReflection.
property EVENT_CREATE_SIGNATURE
static readonly EVENT_CREATE_SIGNATURE: string;
Triggered when the converter has created a signature reflection. The listener will be given Context, Models.SignatureReflection | Models.ProjectReflection the declaration,
ts.SignatureDeclaration | ts.IndexSignatureDeclaration | ts.JSDocSignature | undefined
, andts.Signature | undefined
. The signature will be undefined if the created signature is an index signature.
property EVENT_CREATE_TYPE_PARAMETER
static readonly EVENT_CREATE_TYPE_PARAMETER: string;
Triggered when the converter has created a type parameter reflection. The listener will be given Context and a Models.TypeParameterReflection
property EVENT_END
static readonly EVENT_END: string;
Triggered when the converter has finished converting a project. The listener will be given a Context object.
property EVENT_RESOLVE
static readonly EVENT_RESOLVE: string;
Triggered when the converter resolves a reflection. The listener will be given Context and a Reflection.
property EVENT_RESOLVE_BEGIN
static readonly EVENT_RESOLVE_BEGIN: string;
Triggered when the converter begins resolving a project. The listener will be given Context.
property EVENT_RESOLVE_END
static readonly EVENT_RESOLVE_END: string;
Triggered when the converter has finished resolving a project. The listener will be given Context.
property excludeExternals
excludeExternals: boolean;
property excludeNotDocumented
excludeNotDocumented: boolean;
property excludePrivate
excludePrivate: boolean;
property excludeProtected
excludeProtected: boolean;
property excludeReferences
excludeReferences: boolean;
property externalPattern
externalPattern: string[];
property externalSymbolLinkMappings
externalSymbolLinkMappings: Record<string, Record<string, string>>;
property maxTypeConversionDepth
maxTypeConversionDepth: number;
property preserveLinkText
preserveLinkText: boolean;
property validation
validation: ValidationOptions;
method addUnknownSymbolResolver
addUnknownSymbolResolver: (resolver: ExternalSymbolResolver) => void;
Adds a new resolver that the theme can use to try to figure out how to link to a symbol declared by a third-party library which is not included in the documentation.
The resolver function will be passed a declaration reference which it can attempt to resolve. If resolution fails, the function should return undefined.
Note: This will be used for both references to types declared in node_modules (in which case the reference passed will have the
moduleSource
set and thesymbolReference
will navigate via.
) and user defined {@link} tags which cannot be resolved. If the link being resolved is inferred from a type, then nopart
will be passed to the resolver function.
method convert
convert: (entryPoints: readonly DocumentationEntryPoint[]) => ProjectReflection;
Compile the given source files and create a project reflection for them.
method parseRawComment
parseRawComment: ( file: MinimalSourceFile, files: FileRegistry) => { content: CommentDisplayPart[]; frontmatter: Record<string, unknown> };
Parse the given file into a comment. Intended to be used with markdown files.
method processDocumentTags
processDocumentTags: ( reflection: Reflection, parent: ContainerReflection) => void;
method resolveLinks
resolveLinks: { (comment: Comment, owner: Reflection): void; ( parts: readonly CommentDisplayPart[], owner: Reflection ): CommentDisplayPart[];};
class DeclarationReflection
class DeclarationReflection extends ContainerReflection {}
A reflection that represents a single declaration emitted by the TypeScript compiler.
All parts of a project are represented by DeclarationReflection instances. The actual kind of a reflection is stored in its ´kind´ member. Reflections
property defaultValue
defaultValue?: string;
The default value of this reflection.
Applies to function parameters, variables, and properties.
property extendedBy
extendedBy?: ReferenceType[];
A list of all types that extend this reflection (e.g. the subclasses).
property extendedTypes
extendedTypes?: SomeType[];
A list of all types this reflection extends (e.g. the parent classes).
property getSignature
getSignature?: SignatureReflection;
The get signature of this declaration.
property implementationOf
implementationOf?: ReferenceType;
A type that points to the reflection this reflection is the implementation of.
Applies to class members.
property implementedBy
implementedBy?: ReferenceType[];
A list of all types that implement this reflection.
property implementedTypes
implementedTypes?: SomeType[];
A list of all types this reflection implements.
property indexSignatures
indexSignatures?: SignatureReflection[];
The index signature of this declaration.
property inheritedFrom
inheritedFrom?: ReferenceType;
A type that points to the reflection this reflection has been inherited from.
Applies to interface and class members.
property overwrites
overwrites?: ReferenceType;
A type that points to the reflection that has been overwritten by this reflection.
Applies to interface and class members.
property packageVersion
packageVersion?: string;
The version of the module when found.
property readme
readme?: CommentDisplayPart[];
The contents of the readme file of the module when found.
property relevanceBoost
relevanceBoost?: number;
Precomputed boost for search results, may be less than 1 to de-emphasize this member in search results. Does NOT include group/category values as they are computed when building the JS index.
This is preserved for plugins, and may be removed in 0.28 if no plugins have used it yet.
property setSignature
setSignature?: SignatureReflection;
The set signature of this declaration.
property signatures
signatures?: SignatureReflection[];
A list of call signatures attached to this declaration.
TypeDoc creates one declaration per function that may contain one or more signature reflections.
property sources
sources?: SourceReference[];
A list of all source files that contributed to this reflection.
property type
type?: SomeType;
The type of the reflection.
If the reflection represents a variable or a property, this is the value type. If the reflection represents a signature, this is the return type.
property typeHierarchy
typeHierarchy?: DeclarationHierarchy;
Contains a simplified representation of the type hierarchy suitable for being rendered in templates.
property typeParameters
typeParameters?: TypeParameterReflection[];
property variant
readonly variant: 'declaration' | 'reference';
method fromObject
fromObject: ( de: Deserializer, obj: JSONOutput.DeclarationReflection | JSONOutput.ProjectReflection) => void;
method getAllSignatures
getAllSignatures: () => SignatureReflection[];
method getChildOrTypePropertyByName
getChildOrTypePropertyByName: ( path: string[]) => DeclarationReflection | undefined;
method getNonIndexSignatures
getNonIndexSignatures: () => SignatureReflection[];
method getProperties
getProperties: () => DeclarationReflection[];
method hasGetterOrSetter
hasGetterOrSetter: () => boolean;
method isDeclaration
isDeclaration: () => this is DeclarationReflection;
method toObject
toObject: (serializer: Serializer) => JSONOutput.DeclarationReflection;
method toString
toString: () => string;
Return a string representation of this reflection.
method traverse
traverse: (callback: TraverseCallback) => void;
class DefaultTheme
class DefaultTheme extends Theme {}
constructor
constructor(renderer: Renderer);
Create a new DefaultTheme instance.
Parameter renderer
The renderer this theme is attached to.
property defaultLayoutTemplate
defaultLayoutTemplate: ( pageEvent: PageEvent<Reflection>, template: RenderTemplate<PageEvent<Reflection>>) => JSX.Element;
property documentTemplate
documentTemplate: (pageEvent: PageEvent<DocumentReflection>) => JSX.Element;
property hierarchyTemplate
hierarchyTemplate: (pageEvent: PageEvent<ProjectReflection>) => JSX.Element;
property icons
icons: { search: () => JSX.Element; anchor: () => JSX.Element; 1: () => JSX.Element; 2: () => JSX.Element; 4: () => JSX.Element; 8: () => JSX.Element; 16: () => JSX.Element; 32: () => JSX.Element; 64: () => JSX.Element; 128: () => JSX.Element; 256: () => JSX.Element; 512: () => JSX.Element; 1024: () => JSX.Element; 2048: () => JSX.Element; 4096: () => JSX.Element; 8192: () => JSX.Element; 16384: () => JSX.Element; 32768: () => JSX.Element; 65536: () => JSX.Element; 131072: () => JSX.Element; 262144: () => JSX.Element; 524288: () => JSX.Element; 1048576: () => JSX.Element; 2097152: () => JSX.Element; 4194304: () => JSX.Element; 8388608: () => JSX.Element; checkbox: () => JSX.Element; chevronDown: () => JSX.Element; menu: () => JSX.Element; chevronSmall: () => JSX.Element; folder: () => JSX.Element; alertNote: () => JSX.Element; alertTip: () => JSX.Element; alertImportant: () => JSX.Element; alertWarning: () => JSX.Element; alertCaution: () => JSX.Element;};
The icons which will actually be rendered. The source of truth lives on the theme, and the DefaultThemeRenderContext.icons member will produce references to these.
These icons will be written twice. Once to an
icons.svg
file in the assets directory which will be referenced by icons on the context, and once to anicons.js
file so that references to the icons can be dynamically embedded within the page for use by the search dropdown and when loading the page onfile://
urls.Custom themes may overwrite this entire object or individual properties on it to customize the icons used within the page, however TypeDoc currently assumes that all icons are svg elements, so custom themes must also use svg elements.
property indexTemplate
indexTemplate: (pageEvent: PageEvent<ProjectReflection>) => JSX.Element;
property reflectionTemplate
reflectionTemplate: (pageEvent: PageEvent<ContainerReflection>) => JSX.Element;
property sluggerConfiguration
sluggerConfiguration: any;
property URL_PREFIX
static URL_PREFIX: RegExp;
property usedFileNames
usedFileNames: Set<string>;
method applyAnchorUrl
applyAnchorUrl: (reflection: Reflection, container: Reflection) => void;
Generate an anchor url for the given reflection and all of its children.
Parameter reflection
The reflection an anchor url should be created for.
Parameter container
The nearest reflection having an own document.
method buildNavigation
buildNavigation: (project: ProjectReflection) => NavigationElement[];
method buildUrls
buildUrls: ( reflection: DeclarationReflection | DocumentReflection, urls: UrlMapping[]) => UrlMapping[];
Build the url for the the given reflection and all of its children.
Parameter reflection
The reflection the url should be created for.
Parameter urls
The array the url should be appended to.
Returns
The altered urls array.
method getFileName
getFileName: (reflection: Reflection) => string;
Parameter reflection
The reflection the url should be generated for.
method getNavigation
getNavigation: (project: ProjectReflection) => NavigationElement[];
If implementing a custom theme, it is recommended to override buildNavigation instead.
method getReflectionClasses
getReflectionClasses: ( reflection: DeclarationReflection | DocumentReflection) => string;
method getRenderContext
getRenderContext: ( pageEvent: PageEvent<Reflection>) => DefaultThemeRenderContext;
method getUrls
getUrls: (project: ProjectReflection) => UrlMapping[];
Map the models of the given project to the desired output files.
Parameter project
The project whose urls should be generated.
Returns
A list of UrlMapping instances defining which models should be rendered to which files.
method render
render: ( page: PageEvent<Reflection>, template: RenderTemplate<PageEvent<Reflection>>) => string;
class DefaultThemeRenderContext
class DefaultThemeRenderContext {}
constructor
constructor(theme: DefaultTheme, page: PageEvent<Reflection>, options: Options);
property breadcrumb
breadcrumb: ( props: Reflection) => import('../../../utils/jsx.elements.js').JsxElement | undefined;
property commentShortSummary
commentShortSummary: ( props: Reflection) => import('../../../utils/jsx.elements.js').JsxElement | undefined;
property commentSummary
commentSummary: ( props: Reflection) => import('../../../utils/jsx.elements.js').JsxElement | undefined;
property commentTags
commentTags: ( props: Reflection) => import('../../../utils/jsx.elements.js').JsxElement | undefined;
property defaultLayout
defaultLayout: ( template: import('../../index.js').RenderTemplate<PageEvent<Reflection>>, props: PageEvent<Reflection>) => import('../../../utils/jsx.elements.js').JsxElement;
property displayParts
displayParts: ( parts: readonly CommentDisplayPart[] | undefined) => import('../../../utils/jsx.elements.js').JsxElement | undefined;
Renders user comment markdown wrapped in a tsd-comment div
property documentTemplate
documentTemplate: ( props: PageEvent<DocumentReflection>) => import('../../../utils/jsx.elements.js').JsxElement;
property footer
footer: () => import('../../../utils/jsx.elements.js').JsxElement;
property getNavigation
getNavigation: () => import('./DefaultTheme.js').NavigationElement[];
property getReflectionClasses
getReflectionClasses: ( refl: DeclarationReflection | DocumentReflection) => string;
property header
header: ( props: PageEvent<Reflection>) => import('../../../utils/jsx.elements.js').JsxElement;
property hierarchy
hierarchy: ( typeHierarchy: | import('../../../models/index.js').DeclarationHierarchy | undefined) => import('../../../utils/jsx.elements.js').JsxElement | undefined;
property hierarchyTemplate
hierarchyTemplate: ( props: PageEvent<import('../../../models/index.js').ProjectReflection>) => import('../../../utils/jsx.elements.js').JsxElement;
property hook
hook: <K extends keyof RendererHooks>( event: K, ...args: RendererHooks[K]) => JsxElement[];
property i18n
i18n: TranslationProxy;
property icons
readonly icons: Readonly< Record< | ReflectionKind | 'chevronDown' | 'checkbox' | 'menu' | 'search' | 'chevronSmall' | 'anchor' | 'folder' | 'alertNote' | 'alertTip' | 'alertImportant' | 'alertWarning' | 'alertCaution', () => JsxElement >>;
Icons available for use within the page.
Note: This creates a reference to icons declared by DefaultTheme.icons, to customize icons, that object must be modified instead.
property index
index: ( props: import('../../../models/index.js').ContainerReflection) => import('../../../utils/jsx.elements.js').JsxElement;
property indexTemplate
indexTemplate: ( props: PageEvent<import('../../../models/index.js').ProjectReflection>) => import('../../../utils/jsx.elements.js').JsxElement;
property internationalization
internationalization: Internationalization;
property markdown
markdown: ( md: readonly CommentDisplayPart[] | NeverIfInternal<string | undefined>) => string;
property member
member: ( props: DeclarationReflection | DocumentReflection) => import('../../../utils/jsx.elements.js').JsxElement;
property memberDeclaration
memberDeclaration: ( props: DeclarationReflection) => import('../../../utils/jsx.elements.js').JsxElement;
property memberGetterSetter
memberGetterSetter: ( props: DeclarationReflection) => import('../../../utils/jsx.elements.js').JsxElement;
property members
members: ( props: import('../../../models/index.js').ContainerReflection) => import('../../../utils/jsx.elements.js').JsxElement;
property memberSignatureBody
memberSignatureBody: ( props: import('../../../models/index.js').SignatureReflection, r_1?: { hideSources?: boolean } | undefined) => import('../../../utils/jsx.elements.js').JsxElement;
property memberSignatures
memberSignatures: ( props: DeclarationReflection) => import('../../../utils/jsx.elements.js').JsxElement;
property memberSignatureTitle
memberSignatureTitle: ( props: import('../../../models/index.js').SignatureReflection, options?: { hideName?: boolean } | undefined) => import('../../../utils/jsx.elements.js').JsxElement;
property memberSources
memberSources: ( props: | DeclarationReflection | import('../../../models/index.js').SignatureReflection) => import('../../../utils/jsx.elements.js').JsxElement;
property moduleMemberSummary
moduleMemberSummary: ( member: DeclarationReflection | DocumentReflection) => import('../../../utils/jsx.elements.js').JsxElement;
property moduleReflection
moduleReflection: ( mod: | DeclarationReflection | import('../../../models/index.js').ProjectReflection) => import('../../../utils/jsx.elements.js').JsxElement;
property navigation
navigation: ( props: PageEvent<Reflection>) => import('../../../utils/jsx.elements.js').JsxElement;
property options
options: Options;
property page
page: PageEvent<Reflection>;
property pageNavigation
pageNavigation: ( props: PageEvent<Reflection>) => import('../../../utils/jsx.elements.js').JsxElement;
property pageSidebar
pageSidebar: ( props: PageEvent<Reflection>) => import('../../../utils/jsx.elements.js').JsxElement;
property reflectionFlags
reflectionFlags: ( props: Reflection) => import('../../../utils/jsx.elements.js').JsxElement;
property reflectionPreview
reflectionPreview: ( props: Reflection) => import('../../../utils/jsx.elements.js').JsxElement | undefined;
Rendered just after the description for a reflection. This can be used to render a shortened type display of a reflection that the rest of the page expands on.
Note: Will not be called for variables/type aliases, as they are summarized by their type declaration, which is already rendered by DefaultThemeRenderContext.memberDeclaration
property reflectionTemplate
reflectionTemplate: ( props: PageEvent<import('../../../models/index.js').ContainerReflection>) => import('../../../utils/jsx.elements.js').JsxElement;
property relativeURL
relativeURL: (url: string, cacheBust?: boolean) => string;
Avoid this in favor of urlTo if possible
property settings
settings: () => import('../../../utils/jsx.elements.js').JsxElement;
property sidebar
sidebar: ( props: PageEvent<Reflection>) => import('../../../utils/jsx.elements.js').JsxElement;
property sidebarLinks
sidebarLinks: () => import('../../../utils/jsx.elements.js').JsxElement | null;
property slugger
readonly slugger: Slugger;
property theme
readonly theme: DefaultTheme;
property toolbar
toolbar: ( props: PageEvent<Reflection>) => import('../../../utils/jsx.elements.js').JsxElement;
property type
type: ( type: import('../../../models/types.js').SomeType | undefined, options?: { topLevelLinks: boolean } | undefined) => import('../../../utils/jsx.elements.js').JsxElement;
property typeAndParent
typeAndParent: ( props: import('../../../models/types.js').Type) => import('../../../utils/jsx.elements.js').JsxElement;
property typeDeclaration
typeDeclaration: ( type: import('../../../models/types.js').SomeType) => import('../../../utils/jsx.elements.js').JsxChildren;
Wrapper around typeDetails which checks if it is useful and includes a "Type Declaration" header.
property typeDetails
typeDetails: ( type: import('../../../models/types.js').SomeType, renderAnchors: boolean) => import('../../../utils/jsx.elements.js').JsxChildren;
Used to render additional details about a type. This is used to implement the
@expand
tag, comments on union members, comments on object type members...
property typeDetailsIfUseful
typeDetailsIfUseful: ( type: import('../../../models/types.js').SomeType | undefined) => import('../../../utils/jsx.elements.js').JsxChildren;
Should call the typeDetails helper if rendering additional details about the type will provide the user with more information about the type.
property typeParameters
typeParameters: ( typeParameters: import('../../../models/index.js').TypeParameterReflection[]) => import('../../../utils/jsx.elements.js').JsxElement;
property urlTo
urlTo: (reflection: Reflection) => string;
class Deserializer
class Deserializer {}
Deserializes TypeDoc's JSON output back to Reflection instances.
Common Deserializes TypeDoc's JSON output
constructor
constructor(application: Application);
property application
readonly application: Application;
property logger
readonly logger: Logger;
property oldFileIdToNewFileId
oldFileIdToNewFileId: Record<number, number>;
property oldIdToNewId
oldIdToNewId: Record<number, number>;
property project
project: ProjectReflection;
property projectRoot
projectRoot: string;
Only set when deserializing.
property reflectionBuilders
reflectionBuilders: { declaration: ( parent: Reflection, obj: JSONOutput.DeclarationReflection | JSONOutput.ReferenceReflection ) => DeclarationReflection; param: ( parent: SignatureReflection, obj: JSONOutput.ParameterReflection ) => ParameterReflection; project: ( parent: Reflection, obj: JSONOutput.ProjectReflection ) => ProjectReflection; reference: ( parent: Reflection, obj: JSONOutput.ReferenceReflection ) => ReferenceReflection; signature: ( parent: DeclarationReflection, obj: JSONOutput.SignatureReflection ) => SignatureReflection; typeParam: ( parent: DeclarationReflection | SignatureReflection, obj: JSONOutput.TypeParameterReflection ) => TypeParameterReflection; document: ( parent: Reflection, obj: JSONOutput.DocumentReflection ) => DocumentReflection;};
property typeBuilders
typeBuilders: { array: (obj: JSONOutput.ArrayType, de: Deserializer) => ArrayType; conditional: ( obj: JSONOutput.ConditionalType, de: Deserializer ) => ConditionalType; indexedAccess: ( obj: JSONOutput.IndexedAccessType, de: Deserializer ) => IndexedAccessType; inferred: (obj: JSONOutput.InferredType, de: Deserializer) => InferredType; intersection: ( obj: JSONOutput.IntersectionType, de: Deserializer ) => IntersectionType; intrinsic: ( obj: JSONOutput.IntrinsicType, de: Deserializer ) => IntrinsicType; literal: (obj: JSONOutput.LiteralType, de: Deserializer) => LiteralType; mapped: (obj: JSONOutput.MappedType, de: Deserializer) => MappedType; optional: (obj: JSONOutput.OptionalType, de: Deserializer) => OptionalType; predicate: ( obj: JSONOutput.PredicateType, de: Deserializer ) => PredicateType; query: (obj: JSONOutput.QueryType, de: Deserializer) => QueryType; reference: ( obj: JSONOutput.ReferenceType, de: Deserializer ) => ReferenceType; reflection: ( obj: JSONOutput.ReflectionType, de: Deserializer ) => ReflectionType; rest: (obj: JSONOutput.RestType, de: Deserializer) => RestType; templateLiteral: ( obj: JSONOutput.TemplateLiteralType, de: Deserializer ) => TemplateLiteralType; tuple: (obj: JSONOutput.TupleType, de: Deserializer) => TupleType; namedTupleMember: ( obj: JSONOutput.NamedTupleMemberType, de: Deserializer ) => NamedTupleMember; typeOperator: ( obj: JSONOutput.TypeOperatorType, de: Deserializer ) => TypeOperatorType; union: (obj: JSONOutput.UnionType, de: Deserializer) => UnionType; unknown: (obj: JSONOutput.UnknownType, de: Deserializer) => UnknownType;};
method addDeserializer
addDeserializer: (de: DeserializerComponent) => void;
method constructReflection
constructReflection: <T extends JSONOutput.SomeReflection>( obj: T) => ReflectionVariant[T['variant']];
method constructType
constructType: <T extends JSONOutput.SomeType>(obj: T) => TypeKindMap[T['type']];
method defer
defer: (cb: (project: ProjectReflection) => void) => void;
Defers work until the initial pass of serialization has been completed. This can be used to set up references which cannot be immediately restored.
May only be called when deserializing.
method fromObject
fromObject: <T>( receiver: { fromObject(d: Deserializer, o: T): void }, obj: T) => void;
method revive
revive: { <T, U extends Deserializable<T>>( source: NonNullable<T>, creator: (obj: T) => U ): U; <T, U extends Deserializable<T>>(source: T, creator: (obj: T) => U): U;};
method reviveMany
reviveMany: { <T, U extends Deserializable<T>>( sourceArray: T[], creator: (obj: T) => U ): U[]; <T, U extends Deserializable<T>>( sourceArray: T[], creator: (obj: T) => U ): U[];};
method reviveProject
reviveProject: ( name: string, projectObj: JSONOutput.ProjectReflection, options: { projectRoot: string; registry: FileRegistry; addProjectDocuments?: boolean; }) => ProjectReflection;
Revive a single project into the structure it was originally created with. This is generally not appropriate for merging multiple projects since projects may contain reflections in their root, not inside a module.
method reviveProjects
reviveProjects: ( name: string, projects: readonly JSONOutput.ProjectReflection[], options: { projectRoot: string; registry: FileRegistry; addProjectDocuments?: boolean; }) => ProjectReflection;
method reviveType
reviveType: { <T extends JSONOutput.SomeType>(obj: T): TypeKindMap[T['type']]; <T extends JSONOutput.SomeType>(obj: T): TypeKindMap[T['type']];};
class DocumentReflection
class DocumentReflection extends Reflection {}
Non-TS reflection type which is used to represent markdown documents included in the docs.
constructor
constructor( name: string, parent: Reflection, content: CommentDisplayPart[], frontmatter: Record<string, unknown>);
property children
children?: DocumentReflection[];
Child documents, if any are present.
property content
content: CommentDisplayPart[];
The content to be displayed on the page for this reflection.
property frontmatter
frontmatter: Record<string, unknown>;
Frontmatter included in document
property relevanceBoost
relevanceBoost?: number;
A precomputed boost derived from the searchCategoryBoosts and searchGroupBoosts options, used when boosting search relevance scores at runtime. May be modified by plugins.
property variant
readonly variant: string;
method addChild
addChild: (child: DocumentReflection) => void;
method fromObject
fromObject: (de: Deserializer, obj: JSONOutput.DocumentReflection) => void;
method isDocument
isDocument: () => this is DocumentReflection;
method toObject
toObject: (serializer: Serializer) => JSONOutput.DocumentReflection;
method traverse
traverse: (callback: TraverseCallback) => void;
class EventDispatcher
class EventDispatcher<T extends Record<keyof T, unknown[]>> {}
Intentionally very simple event emitter.
method off
off: <K extends keyof T>( event: K, listener: (this: undefined, ...args: T[K]) => void) => void;
Stops listening to an event.
Parameter event
the event to stop listening to.
Parameter listener
the function to remove from the listener array.
method on
on: <K extends keyof T>( event: K, listener: (this: undefined, ...args: T[K]) => void, priority?: number) => void;
Starts listening to an event.
Parameter event
the event to listen to.
Parameter listener
function to be called when an this event is emitted.
Parameter priority
optional priority to insert this hook with.
method trigger
trigger: <K extends keyof T>(event: K, ...args: T[K]) => void;
Emits an event to all currently subscribed listeners.
Parameter event
the event to emit.
Parameter args
any arguments required for the event.
class EventHooks
class EventHooks<T extends Record<keyof T, unknown[]>, R> {}
Event emitter which allows listeners to return a value.
This is beneficial for the themes since it allows plugins to modify the HTML output without doing unsafe text replacement.
Very simple event emitter class which collects the return values of its listeners.
Example 1
const x = new EventHooks<{ a: [string] }, string>()x.on('a', a => a.repeat(123)) // ok, returns a stringx.on('b', console.log) // error, 'b' is not assignable to 'a'x.on('a' a => 1) // error, returns a number but expected a string
method emit
emit: <K extends keyof T>(event: K, ...args: T[K]) => R[];
Emits an event to all currently subscribed listeners.
Parameter event
the event to emit.
Parameter args
any arguments required for the event.
method off
off: <K extends keyof T>(event: K, listener: (...args: T[K]) => R) => void;
Stops listening to an event.
Parameter event
the event to stop listening to.
Parameter listener
the function to remove from the listener array.
method on
on: <K extends keyof T>( event: K, listener: (...args: T[K]) => R, order?: number) => void;
Starts listening to an event.
Parameter event
the event to listen to.
Parameter listener
function to be called when an this event is emitted.
Parameter order
optional order to insert this hook with.
method once
once: <K extends keyof T>( event: K, listener: (...args: T[K]) => R, order?: number) => void;
Listens to a single occurrence of an event.
Parameter event
the event to listen to.
Parameter listener
function to be called when an this event is emitted.
Parameter order
optional order to insert this hook with.
method restoreMomento
restoreMomento: (momento: EventHooksMomento<T, R>) => void;
method saveMomento
saveMomento: () => EventHooksMomento<T, R>;
class FileRegistry
class FileRegistry {}
property mediaToPath
protected mediaToPath: Map<number, string>;
property mediaToReflection
protected mediaToReflection: Map<number, ReflectionId>;
property names
protected names: Map<number, string>;
property nameUsage
protected nameUsage: Map<string, number>;
property nextId
protected nextId: number;
property pathToMedia
protected pathToMedia: Map<string, number>;
property reflectionToPath
protected reflectionToPath: Map<ReflectionId, string>;
method fromObject
fromObject: (de: Deserializer, obj: JSONFileRegistry) => void;
Revive a file registry from disc. Note that in the packages context this may be called multiple times on a single object, and should merge in files from the other registries.
method getName
getName: (id: number) => string | undefined;
method getNameToAbsoluteMap
getNameToAbsoluteMap: () => ReadonlyMap<string, string>;
method getReflectionPath
getReflectionPath: (reflection: Reflection) => string | undefined;
method register
register: ( sourcePath: string, relativePath: string) => { target: number; anchor: string | undefined } | undefined;
method registerAbsolute
registerAbsolute: (absolute: string) => { target: number; anchor: string | undefined;};
method removeReflection
removeReflection: (reflection: Reflection) => void;
method resolve
resolve: ( id: number, project: ProjectReflection) => string | Reflection | undefined;
method toObject
toObject: (ser: Serializer) => JSONFileRegistry;
class IndexedAccessType
class IndexedAccessType extends Type {}
Represents an indexed access type. Types
constructor
constructor(objectType: SomeType, indexType: SomeType);
property indexType
indexType: SomeType;
property objectType
objectType: SomeType;
property type
readonly type: string;
method getTypeString
protected getTypeString: () => string;
method needsParenthesis
needsParenthesis: () => boolean;
method toObject
toObject: (serializer: Serializer) => JSONOutput.IndexedAccessType;
class IndexEvent
class IndexEvent {}
An event emitted when the search index is being prepared.
constructor
constructor(searchResults: (DeclarationReflection | DocumentReflection)[]);
property PREPARE_INDEX
static readonly PREPARE_INDEX: string;
Triggered on the renderer when the search index is being prepared.
property searchFields
searchFields: Record<string, string>[];
Additional search fields to be used when creating the search index.
name
,comment
anddocument
may be specified to overwrite TypeDoc's search fields.Do not use
id
as a custom search field.
property searchFieldWeights
readonly searchFieldWeights: Record<string, number>;
Weights for the fields defined in
searchFields
. The default will weightname
as 10x more important than comment and document content.If a field added to searchFields is not added to this object, it will **not** be searchable.
Do not replace this object, instead, set new properties on it for custom search fields added by your plugin.
property searchResults
searchResults: (DeclarationReflection | DocumentReflection)[];
May be filtered by plugins to reduce the results available. Additional items *should not* be added to this array.
If you remove an index from this array, you must also remove the same index from searchFields. The removeResult helper will do this for you.
method removeResult
removeResult: (index: number) => void;
Remove a search result by index.
class InferredType
class InferredType extends Type {}
Represents an inferred type, U in the example below.
type Z = Promise<string> extends Promise<infer U> : neverTypes
constructor
constructor(name: string, constraint?: SomeType);
property constraint
constraint?: SomeType;
property name
name: string;
property type
readonly type: string;
method getTypeString
protected getTypeString: () => string;
method needsParenthesis
needsParenthesis: (context: TypeContext) => boolean;
method toObject
toObject: (serializer: Serializer) => JSONOutput.InferredType;
class IntersectionType
class IntersectionType extends Type {}
Represents an intersection type.
let value: A & B;Types
constructor
constructor(types: SomeType[]);
property type
readonly type: string;
property types
types: SomeType[];
method getTypeString
protected getTypeString: () => string;
method needsParenthesis
needsParenthesis: (context: TypeContext) => boolean;
method toObject
toObject: (serializer: Serializer) => JSONOutput.IntersectionType;
class IntrinsicType
class IntrinsicType extends Type {}
Represents an intrinsic type like
string
orboolean
.let value: number;Types
constructor
constructor(name: string);
property name
name: string;
property type
readonly type: string;
method getTypeString
protected getTypeString: () => string;
method needsParenthesis
needsParenthesis: () => boolean;
method toObject
toObject: () => JSONOutput.IntrinsicType;
class LiteralType
class LiteralType extends Type {}
Represents a literal type.
type A = "A"type B = 1Types
constructor
constructor(value: string | number | bigint | boolean);
property type
readonly type: string;
property value
value: string | number | bigint | boolean;
method getTypeString
protected getTypeString: () => string;
Return a string representation of this type.
method needsParenthesis
needsParenthesis: () => boolean;
method toObject
toObject: () => JSONOutput.LiteralType;
class Logger
class Logger {}
A logger that will not produce any output.
This logger also serves as the base class of other loggers as it implements all the required utility functions.
property errorCount
errorCount: number;
How many error messages have been logged?
property i18n
i18n: TranslationProxy;
Translation utility for internationalization.
property level
level: LogLevel;
The minimum logging level to print.
property warningCount
warningCount: number;
How many warning messages have been logged?
method addContext
protected addContext: ( message: string, _level: LogLevel, ..._args: [ts.Node?] | [number, MinimalSourceFile]) => string;
method diagnostic
diagnostic: (diagnostic: ts.Diagnostic) => void;
Print the given TypeScript log message.
Parameter diagnostic
The TypeScript message that should be logged.
method diagnostics
diagnostics: (diagnostics: ReadonlyArray<ts.Diagnostic>) => void;
Print the given TypeScript log messages.
Parameter diagnostics
The TypeScript messages that should be logged.
method error
error: { (text: IfInternal<TranslatedString, string>, node?: ts.Node): void; (text: string, pos: number, file: MinimalSourceFile): void;};
Log the given error.
Parameter text
The error that should be logged.
method hasErrors
hasErrors: () => boolean;
Has an error been raised through the log method?
method hasWarnings
hasWarnings: () => boolean;
Has a warning been raised through the log method?
method info
info: (text: IfInternal<TranslatedString, string>) => void;
Log the given info message.
method log
log: (_message: string, level: LogLevel) => void;
Print a log message.
Parameter _message
The message itself.
Parameter level
The urgency of the log message.
method resetErrors
resetErrors: () => void;
Reset the error counter.
method resetWarnings
resetWarnings: () => void;
Reset the warning counter.
method verbose
verbose: (text: string) => void;
Log the given verbose message.
Parameter text
The message that should be logged.
method warn
warn: { (text: IfInternal<TranslatedString, string>, node?: ts.Node): void; (text: string, pos: number, file: MinimalSourceFile): void;};
Log the given warning.
Parameter text
The warning that should be logged.
class MappedType
class MappedType extends Type {}
Represents a mapped type.
{ -readonly [K in Parameter as Name]?: Template }Types
constructor
constructor( parameter: string, parameterType: SomeType, templateType: SomeType, readonlyModifier?: '+' | '-', optionalModifier?: '+' | '-', nameType?: SomeType);
property nameType
nameType?: SomeType;
property optionalModifier
optionalModifier?: '+' | '-';
property parameter
parameter: string;
property parameterType
parameterType: SomeType;
property readonlyModifier
readonlyModifier?: '+' | '-';
property templateType
templateType: SomeType;
property type
readonly type: string;
method getTypeString
protected getTypeString: () => string;