Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inherit comments from spread prop types #792

Closed
milesj opened this issue Jan 25, 2018 · 4 comments
Closed

Inherit comments from spread prop types #792

milesj opened this issue Jan 25, 2018 · 4 comments
Labels
react-docgen Issues in react-docgen library

Comments

@milesj
Copy link

milesj commented Jan 25, 2018

I haven't seen this anywhere in the documentation, and it definitely is not supported right now, but it would be great if the docs could inherit comments from objects who were spread into propTypes, like the following.

const propTypes = {
  /* This does something. */
  bar: PropTypes.node,
};

export default function Foo(props) {
  return <div />;
}

Foo.propTypes = {
  ...propTypes,
};

Foo.defaultProps = {
  bar: null,
};

As it stands, styleguidist shows the bar prop, but without a comment.

@n1313
Copy link
Collaborator

n1313 commented Jan 25, 2018

I think this is something that react-docgen (which parses js files for info for react-styleguidist to consume) should do.

@milesj
Copy link
Author

milesj commented Jan 25, 2018

Thanks, I'll cross post it there too. reactjs/react-docgen#246

@pasupuletics
Copy link
Contributor

@milesj , As @n1313 said its defiantly a bug(at least not supported) of react-docgen. And just to add that react-docgen doesn't support spread operator.

@sapegin
Copy link
Member

sapegin commented Mar 19, 2018

I’m going to close this for now, because there’s nothing we can do on our side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
react-docgen Issues in react-docgen library
Projects
None yet
Development

No branches or pull requests

4 participants