Skip to content

Inherit comments from spread prop types #246

Closed
@milesj

Description

@milesj

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 (in the same file), 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,
};

This would support styleguide's like Airbnb: https://github.com/airbnb/javascript/tree/master/react#ordering

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions