Class DeclarationReflection

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.

Hierarchy (view full)

Constructors

Properties

flags: Models.ReflectionFlags = ...
id: number

Unique id of this reflection.

The kind of this reflection.

name: string

The symbol name of this reflection.

variant: "declaration" | "reference" = ...

Discriminator representing the type of reflection represented by this object.

anchor?: string

The name of the anchor of this child. TODO: Reflections shouldn't know anchors exist. Move this to a serializer.

categories?: Models.ReflectionCategory[]

All children grouped by their category.

The children of this reflection. Do not add reflections to this array manually. Instead call addChild.

childrenIncludingDocuments?: (Models.DeclarationReflection | Models.DocumentReflection)[]

Union of the children and documents arrays which dictates the sort order for rendering.

comment?: Models.Comment

The parsed documentation comment attached to this reflection.

defaultValue?: string

The default value of this reflection.

Applies to function parameters, variables, and properties.

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.

escapedName?: __String

The escaped name of this declaration assigned by the TS compiler if there is an associated symbol. This is used to retrieve properties for analyzing inherited members.

Not serialized, only useful during conversion.

extendedBy?: Models.ReferenceType[]

A list of all types that extend this reflection (e.g. the subclasses).

extendedTypes?: Models.SomeType[]

A list of all types this reflection extends (e.g. the parent classes).

The get signature of this declaration.

All children grouped by their kind.

hasOwnDocument?: boolean

Is the url pointing to an individual document?

When FALSE, the url points to an anchor tag on a page of a different reflection. TODO: Reflections shouldn't know how they are rendered. Move this to the correct serializer.

implementationOf?: Models.ReferenceType

A type that points to the reflection this reflection is the implementation of.

Applies to class members.

implementedBy?: Models.ReferenceType[]

A list of all types that implement this reflection.

implementedTypes?: Models.SomeType[]

A list of all types this reflection implements.

indexSignatures?: Models.SignatureReflection[]

The index signature of this declaration.

inheritedFrom?: Models.ReferenceType

A type that points to the reflection this reflection has been inherited from.

Applies to interface and class members.

overwrites?: Models.ReferenceType

A type that points to the reflection that has been overwritten by this reflection.

Applies to interface and class members.

packageVersion?: string

The version of the module when found.

The reflection this reflection is a child of.

The contents of the readme file of the module when found.

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.

The set signature of this declaration.

A list of call signatures attached to this declaration.

TypeDoc creates one declaration per function that may contain one or more signature reflections.

A list of all source files that contributed to this reflection.

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.

typeHierarchy?: DeclarationHierarchy

Contains a simplified representation of the type hierarchy suitable for being rendered in templates.

typeParameters?: Models.TypeParameterReflection[]
url?: string

The url of this reflection in the generated documentation. TODO: Reflections shouldn't know urls exist. Move this to a serializer.

Methods

  • Return the full name of this reflection. Intended for use in debugging. For log messages intended to be displayed to the user for them to fix, prefer getFriendlyFullName instead.

    The full name contains the name of this reflection and the names of all parent reflections.

    Parameters

    • separator: string = "."

      Separator used to join the names of the reflections.

    Returns string

    The full name of this reflection.

  • Return a string representation of this reflection and all of its children.

    Note: This is intended as a debug tool only, output may change between patch versions.

    Parameters

    • indent: string = ""

      Used internally to indent child reflections.

    Returns string

  • Traverse most potential child reflections of this reflection.

    Note: This may not necessarily traverse child reflections contained within the type property of the reflection, and should not be relied on for this. Support for checking object types will likely be removed in v0.27.

    The given callback will be invoked for all children, signatures and type parameters attached to this reflection.

    Parameters

    • callback: TraverseCallback

      The callback function that should be applied for each child reflection.

    Returns void