microsoft / microsoft/TypeScript

JSDoc support for @yields

Open
#23,857 7 comments 16 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Awaiting More Feedback Domain: JSDoc Suggestion
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

It would be nice to be able to use the @yields JSDoc tag.

We work with JS and JSDoc, but taking advantage of TSC and VSCode.
We also use the valid-jsdoc eslint rule.

We have:

/** @typedef Thing (...) */

function* walkThings() {
//... some yield here and there
}

We want to

/**
 * @yields {Thing}
 */
function* walkThings() {
//... some yield here and there
}

We can't do

/**
 * @returns {IterableIterator<Something>}
 */
function* walkThings() {
//... some yield here and there
}

Because it doesn't return, but yields, and eslint complains about it. We can disable the rule here, but it is not the desirable scenario.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No repository file or test is named. Start by tracing TypeScript's existing JSDoc handling for generator functions and @returns, then compare it with the @yields {Thing} example. Done means the tag is accepted with the intended yielded type and covered by focused tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
compilers, developer-experience
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.