Class ProjectReflection

A reflection that represents the root of the project.

The project reflection acts as a global index, one may receive all reflections and source files of the processed project through this reflection.

Hierarchy (View Summary)

Constructors

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.

  • Registers the given reflection so that it can be quickly looked up by helper methods. Should be called for every reflection added to the project.

    Parameters

    • reflection: Models.Reflection
    • symbol: undefined | Symbol
    • filePath: undefined | string

    Returns void

  • Removes references to reflections contained within the provided type. Plugins which overwrite types on reflections should pass the type to this method before overwriting the property.

    Parameters

    Returns void

    0.26.6

  • 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

    Returns void

Properties

Object which describes where to find content for relative links.

flags: Models.ReflectionFlags = ...

Unique id of this reflection.

The kind of this reflection.

name: string

The symbol name of this reflection.

reflections: { [id: number]: Models.Reflection } = ...

A list of all reflections within the project. DO NOT MUTATE THIS OBJECT. All mutation should be done via registerReflection and removeReflection to ensure that links to reflections remain valid.

This may be replaced with a Map<number, Reflection> someday.

variant: "project"

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.

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.

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.

packageName?: string

The name of the package that this reflection documents according to package.json.

packageVersion?: string

The version of the package that this reflection documents according to package.json.

The reflection this reflection is a child of.

The contents of the readme.md file of the project when found.

url?: string

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