DocGen not recognizing decomposed function parameters

Open
#238 2 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript, react
Domain
documentation

Research direction

Start by reproducing the documented destructured function example and inspect how DocGen extracts parameter names and JSDoc properties. Done means the generated documentation recognizes the user parameter and its description instead of reporting the name as { user }, while preserving the documented prop structure.

Written by the indexing model from the issue text.

Description

improvement

Within one of my components, I wrote a function that would fetch user data given a username passed as a prop. The function is referenced through lifecycle in multiple places and is documented as below.

/**
 * @param {Object} prop - component props
 * @param {string} prop.user - user whose profile should be fetched
 */
fetch = ({ user }) => {
  // ...
}

The resulting doc does not reference anything from the above and simply puts name: '{ user }' as the parameter. I thought I would be able to use JSDoc syntax.

Dominant language
TypeScript
Stars
3.8k
Forks
316
Avg merge
3h 28m
Merged PRs (30d)
6

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.

More from reactjs/react-docgen

All issues in reactjs/react-docgen

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.