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

ApiProperty class

Represents a TypeScript property declaration that belongs to an ApiClass.


export declare class ApiProperty extends ApiProperty_base 


Constructor Modifiers Description
(constructor)(options)   Constructs a new instance of the ApiProperty class


Property Modifiers Type Description
containerKey   string  
kind   ApiItemKind  


Method Modifiers Description
buildCanonicalReference()   (BETA)
getContainerKey(name, isStatic) static  


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

ApiProperty represents a TypeScript declaration such as the width and height members in this example:

export class Widget {
  public width: number = 100;

  public get height(): number {
    if (this.isSquashed()) {
      return 0;
    } else {
      return this.clientArea.height;

Note that member variables are also considered to be properties.

If the property has both a getter function and setter function, they will be represented by a single ApiProperty and must have a single documentation comment.

Compare with ApiPropertySignature, which represents a property belonging to an interface. For example, a class property can be static but an interface property cannot.