Rush Stackストアブログイベント
メインコンテンツへ移動

ae-setter-with-docs

プロパティのドキュメント コメントは、___セッターではなくゲッターに表示する必要があります。

備考

API Extractor は、プロパティのゲッターとセッターのペアを単一の API アイテムとしてモデル化します。ゲッターがメイン宣言であり、セッターは「補助」署名として扱われます。ドキュメント コメントがあるのはゲッターのみです。セッターにドキュメント コメントが見つかった場合、API Extractor は ae-setter-with-docs エラーを報告します。

/**
* Represents a book from the catalog.
* @public
*/
export class Book {
private _title: string = 'untitled';

/**
* Gets the title of the book.
*/
public get title(): string {
return this._title;
}

/**
* Sets the title of the book.
*/
// Error: (ae-setter-with-docs) The doc comment for the property "title" must appear
// on the getter, not the setter.
public set title(value: string) {
this._title = value;
}
}

修正方法

セッターからドキュメント コメントを削除します。ゲッターのドキュメント コメントに両方のオプションを記載します。

/**
* Represents a book from the catalog.
* @public
*/
export class Book {
private _title: string = 'untitled';

/**
* Gets or sets the title of the book.
*/
public get title(): string {
return this._title;
}

public set title(value: string) {
this._title = value;
}
}

参照