A model that represents a comment.

Instances of this model are created by the CommentPlugin. You can retrieve comments through the DeclarationReflection.comment property.

Constructors

Methods

  • Test whether this comment contains a tag with the given name.

    Parameters

    • tagName: `@${string}`

      The name of the tag to look for.

    Returns boolean

    TRUE when this comment contains a tag with the given name, otherwise FALSE.

  • Has this comment a visible component?

    Returns boolean

    TRUE when this comment has a visible component.

  • Removes all block tags with the given tag name from the comment.

    Parameters

    • tagName: `@${string}`

    Returns void

Properties

blockTags: Models.CommentTag[] = []

All associated block level tags.

modifierTags: Set<`@${string}`> = ...

All modifier tags present on the comment, e.g. @alpha, @beta.

The content of the comment which is not associated with a block tag.

discoveryId?: number

Internal discovery ID used to prevent symbol comments from being duplicated on signatures. Only set when the comment was created from a ts.CommentRange.

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 a ts.CommentRange.

label?: string

Label associated with this reflection, if any (https://tsdoc.org/pages/tags/label/)

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.