reactjs / react-docgen

A CLI and library to extract information from React component files for documentation generation purposes.
https://react-docgen.dev
MIT License
3.67k stars 296 forks source link

DocGen not recognizing decomposed function parameters #238

Open rkichenama opened 6 years ago

rkichenama commented 6 years ago

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.

fkling commented 6 years ago

Do you have a suggestion for how we should represent destructured parameters in the JSON output?

nemoDreamer commented 6 years ago

It could be very similar to the FlowType output, w/ signature etc.