@defaultValue
标签类型: 块标签
TSDoc 标准化: 扩展
此标签用于记录字段或属性的默认值,如果未显式分配值。此标签仅应与作为类或接口成员的字段或属性一起使用。
作为块标签,@defaultValue
引入一个 TSDoc 部分,其中包含所有注释文本,直到下一个块标签。此内容称为“值文本”。值文本可以有多种形式,例如
- 字面值,例如:
@defaultValue 3
- 代码跨度,例如
@defaultValue
true
- 任意富文本,可能跨越多行,例如
@defaultValue {@link Widget} 对象的实例
因此,文档模板不应假定值文本将完全由代码组成。
使用示例
export enum WarningStyle {
DialogBox,
StatusMessage,
LogOnly
}
export interface IWarningOptions {
/**
* Determines how the warning will be displayed.
*
* @remarks
* See {@link WarningStyle| the WarningStyle enum} for more details.
*
* @defaultValue `WarningStyle.DialogBox`
*/
warningStyle: WarningStyle;
/**
* Whether the warning can interrupt a user's current activity.
*
* @defaultValue
* The default is `true` unless {@link WarningStyle.StatusMessage}
* was requested.
*/
cancellable?: boolean;
message: string;
}