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

ApiProperty class

Represents a TypeScript property declaration that belongs to an ApiClass.

Signature:

export declare class ApiProperty extends ApiProperty_base 

Constructors

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

Properties

Property Modifiers Type Description
containerKey   string  
kind   ApiItemKind  

Methods

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

Remarks

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.