Skip to content

Commit d8002f7

Browse files
committed
Provide a more detailed example in the TypeParameter doc comment
1 parent 0e024ce commit d8002f7

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

apps/api-extractor-model/src/model/TypeParameter.ts

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,17 @@ export interface ITypeParameterOptions {
2626
* `TypeParameter` represents a TypeScript declaration such as `T` in this example:
2727
*
2828
* ```ts
29-
* export interface Array<T> {
29+
* interface IIdentifier {
30+
* getCode(): string;
31+
* }
32+
*
33+
* class BarCode implements IIdentifier {
34+
* private _value: number;
35+
* public getCode(): string { return this._value.toString(); }
36+
* }
37+
*
38+
* class Book<TIdentifier extends IIdentifier = BarCode> {
39+
* public identifier: TIdentifier;
3040
* }
3141
* ```
3242
*
@@ -37,11 +47,29 @@ export interface ITypeParameterOptions {
3747
export class TypeParameter {
3848
/**
3949
* An {@link Excerpt} that describes the base constraint of the type parameter.
50+
*
51+
* @remarks
52+
* In the example below, the `constraintExcerpt` would correspond to the `IIdentifier` subexpression:
53+
*
54+
* ```ts
55+
* class Book<TIdentifier extends IIdentifier = BarCode> {
56+
* public identifier: TIdentifier;
57+
* }
58+
* ```
4059
*/
4160
public readonly constraintExcerpt: Excerpt | undefined;
4261

4362
/**
4463
* An {@link Excerpt} that describes the default type of the type parameter.
64+
*
65+
* @remarks
66+
* In the example below, the `defaultTypeExcerpt` would correspond to the `BarCode` subexpression:
67+
*
68+
* ```ts
69+
* class Book<TIdentifier extends IIdentifier = BarCode> {
70+
* public identifier: TIdentifier;
71+
* }
72+
* ```
4573
*/
4674
public readonly defaultTypeExcerpt: Excerpt | undefined;
4775

0 commit comments

Comments
 (0)