Rush StackShopBlogEvents
Skip to main content

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

TypeParameter class

Represents a named type parameter for a generic declaration.

Signature:

export declare class TypeParameter 

Remarks

TypeParameter represents a TypeScript declaration such as T in this example:

interface IIdentifier {
getCode(): string;
}

class BarCode implements IIdentifier {
private _value: number;
public getCode(): string { return this._value.toString(); }
}

class Book<TIdentifier extends IIdentifier = BarCode> {
public identifier: TIdentifier;
}

TypeParameter objects belong to the ApiTypeParameterListMixin.typeParameters collection.

Constructors

ConstructorModifiersDescription
(constructor)(options)Constructs a new instance of the TypeParameter class

Properties

PropertyModifiersTypeDescription
constraintExcerptreadonlyExcerptAn Excerpt that describes the base constraint of the type parameter.
defaultTypeExcerptreadonlyExcerptAn Excerpt that describes the default type of the type parameter.
isOptionalbooleanWhether the type parameter is optional. True IFF there exists a defaultTypeExcerpt.
namestringThe parameter name.
tsdocTypeParamBlockreadonlytsdoc.DocParamBlock | undefinedReturns the @typeParam documentation for this parameter, if present.