JSDoc 中文网

Synonyms

语法

🌐 Syntax

@yields [{type}] [description]

概述

🌐 Overview

@yields 标签记录生成器函数生成的值。该标签在 JSDoc 3.5.0 及更高版本中可用。

🌐 The @yields tag documents the value that is yielded by a generator function. This tag is available in JSDoc 3.5.0 and later.

如果你正在记录一个普通函数,请使用 @returns 标签 而不是这个标签。

🌐 If you are documenting a regular function, use the @returns tag instead of this tag.

示例

🌐 Examples

@yields 标签带有类型
/**
 * Generate the Fibonacci sequence of numbers.
 *
 * @yields {number}
 */
function* fibonacci() {}
@yields 标记,包含类型和描述
/**
 * Generate the Fibonacci sequence of numbers.
 *
 * @yields {number} The next number in the Fibonacci sequence.
 */
function* fibonacci() {}