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.


export declare class ApiDeclaredItem extends ApiDocumentedItem 

Extends: ApiDocumentedItem


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.


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



(BETA) Warning: This API is used internally by API extractor but is not yet ready for general usage.

(Inherited from ApiItem)


Returns a string key that can be used to efficiently retrieve an ApiItem from an ApiItemContainerMixin. The key is unique within the container. Its format is undocumented and may change at any time.

(Inherited from ApiItem)


Returns a name for this object that can be used in diagnostic messages, for example.

(Inherited from ApiItem)

excerptreadonlyExcerptThe source code excerpt where the API item is declared.
excerptTokensreadonlyReadonlyArray<ExcerptToken>The individual source code tokens that comprise the main excerpt.

Identifies the subclass of the ApiItem base class.

(Inherited from ApiItem)


This property supports a visitor pattern for walking the tree. For items with ApiItemContainerMixin, it returns the contained items, sorted alphabetically. Otherwise it returns an empty array.

(Inherited from ApiItem)

parentreadonlyApiItem | undefined

If this item was added to a ApiItemContainerMixin item, then this returns the container item. If this is an Parameter that was added to a method or function, then this returns the function item. Otherwise, it returns undefined.

(Inherited from ApiItem)

tsdocCommentreadonlytsdoc.DocComment | undefined(Inherited from ApiDocumentedItem)



Builds the cached object used by the canonicalReference property.

(Inherited from ApiItem)

buildExcerpt(tokenRange)Constructs a new Excerpt corresponding to the provided token range.
deserialize(jsonObject, context)static(Inherited from ApiItem)

If this item is an ApiModel or has an ApiModel as one of its parents, then that object is returned. Otherwise undefined is returned.

(Inherited from ApiItem)


If this item is an ApiPackage or has an ApiPackage as one of its parents, then that object is returned. Otherwise undefined is returned.

(Inherited from ApiItem)

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.

Returns the chain of ancestors, starting from the root of the tree, and ending with the this item.

(Inherited from ApiItem)


If this item has a name (i.e. extends ApiNameMixin), then return all items that have the same parent and the same name. Otherwise, return all items that have the same parent and the same ApiItemKind.

(Inherited from ApiItem)


This returns a scoped name such as "Namespace1.Namespace2.MyClass.myMember()". It does not include the package name or entry point.

(Inherited from ApiItem)


A text string whose value determines the sort order that is automatically applied by the ApiItemContainerMixin class.

(Inherited from ApiItem)

onDeserializeInto(options, context, jsonObject)static