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

ApiConstructSignature class

Represents a TypeScript construct signature that belongs to an ApiInterface.

Signature:

export declare class ApiConstructSignature extends ApiConstructSignature_base 

Remarks

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

ApiConstructSignature represents a construct signature using the new keyword such as in this example:

export interface IVector {
  x: number;
  y: number;
}

export interface IVectorConstructor {
  // A construct signature:
  new(x: number, y: number): IVector;
}

export function createVector(vectorConstructor: IVectorConstructor,
  x: number, y: number): IVector {
  return new vectorConstructor(x, y);
}

class Vector implements IVector {
  public x: number;
  public y: number;
  public constructor(x: number, y: number) {
    this.x = x;
    this.y = y;
  }
}

let vector: Vector = createVector(Vector, 1, 2);

Compare with ApiConstructor, which describes the class constructor itself.

Constructors

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

Properties

Property Modifiers Type Description
containerKey   string  
kind   ApiItemKind  

Methods

Method Modifiers Description
buildCanonicalReference()   (BETA)
getContainerKey(overloadIndex) static