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

ConstructorModifiersDescription
(constructor)(options)Constructs a new instance of the ApiDeclaredItem class

Properties

PropertyModifiersTypeDescription
excerptreadonlyExcerptThe source code excerpt where the API item is declared.
excerptTokensreadonlyReadonlyArray<ExcerptToken>The individual source code tokens that comprise the main excerpt.
fileUrlPathreadonlystring | undefinedThe 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.
sourceLocationreadonlySourceLocationReturns the source location where the API item is declared.

Methods

MethodModifiersDescription
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)