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

Excerpt class

This class is used by ApiDeclaredItem to represent a source code excerpt containing a TypeScript declaration.


export declare class Excerpt 


The main excerpt is parsed into an array of tokens, and the main excerpt’s token range will span all of these tokens. The declaration may also have have “captured” excerpts, which are other subranges of tokens. For example, if the main excerpt is a function declaration, it will also have a captured excerpt corresponding to the return type of the function.

An excerpt may be empty (i.e. a token range containing zero tokens). For example, if a function’s return value is not explicitly declared, then the returnTypeExcerpt will be empty. By contrast, a class constructor cannot have a return value, so ApiConstructor has no returnTypeExcerpt property at all.


Constructor Modifiers Description
(constructor)(tokens, tokenRange)   Constructs a new instance of the Excerpt class


Property Modifiers Type Description
isEmpty   boolean  
text   string  
tokenRange   Readonly<IExcerptTokenRange>  
tokens   ReadonlyArray<ExcerptToken>