Rush Stack商店博客活动
跳到主要内容

@typeParam

标准化核心
语法种类块标签

用法

用于记录泛型参数。 @typeParam 标签后跟参数名称,然后是连字符,然后是描述。 TSDoc 解析器识别此语法,并将其提取到 DocParamBlock 节点中。

示例

/**
* Alias for array
*
* @typeParam T - Type of objects the list contains
*/
type List<T> = Array<T>;

/**
* Wrapper for an HTTP Response
* @typeParam B - Response body
* @param <H> - Headers
*/
interface HttpResponse<B, H> {
body: B;
headers: H;
statusCode: number;
}

另请参阅

  • RFC #72: 支持使用 @typeparam@template 记录泛型参数