Rush StackShopBlogEvents
Skip to main content

Home > @microsoft/api-extractor-model > ApiDeclaredItem

ApiDeclaredItem class

The base class for API items that have an associated source code excerpt containing a TypeScript declaration.

Signature:

export declare class ApiDeclaredItem extends ApiDocumentedItem 

Extends: ApiDocumentedItem

Remarks

This is part of the ApiModel hierarchy of classes, which are serializable representations of API declarations.

Most ApiItem subclasses have declarations and thus extend ApiDeclaredItem. Counterexamples include ApiModel and ApiPackage, which do not have any corresponding TypeScript source code.

Constructors

Constructor

Modifiers

Description

(constructor)(options)

Constructs a new instance of the ApiDeclaredItem class

Properties

Property

Modifiers

Type

Description

excerpt

readonly

Excerpt

The source code excerpt where the API item is declared.

excerptTokens

readonly

ReadonlyArray<ExcerptToken>

The individual source code tokens that comprise the main excerpt.

fileUrlPath

readonly

string | undefined

The file URL path relative to the projectFolder and projectFolderURL fields as defined in the api-extractor.json config. Is undefined if the path is the same as the parent API item's.

sourceLocation

readonly

SourceLocation

Returns the source location where the API item is declared.

Methods

Method

Modifiers

Description

buildExcerpt(tokenRange)

Constructs a new Excerpt corresponding to the provided token range.

getExcerptWithModifiers()

If the API item has certain important modifier tags such as @sealed, @virtual, or @override, this prepends them as a doc comment above the excerpt.

onDeserializeInto(options, context, jsonObject)

static

serializeInto(jsonObject)