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

docs(ComponentProps): show func signatures #1194

Merged
merged 1 commit into from
Jan 20, 2017

Conversation

levithomason
Copy link
Member

@levithomason levithomason commented Jan 20, 2017

This PR displays function signatures in the docs as part of #623.

image

These are generated from our doc block comments:

Button.js

/**
 * Called after user's click.
 * @param {SyntheticEvent} event - React's original SyntheticEvent.
 * @param {object} data - All props.
 */
onClick: PropTypes.func,

There is a known limitation with this PR. Only props with type func have their signatures displayed. If a prop uses a more complicated propType, it is parsed by react-docgen as type custom which we do not yet parse for a signature. We should consider adding @type {function} or @callback to callbacks with custom propType checkers, which we can parse to ensure their signatures are displayed.

@levithomason levithomason merged commit f4d3023 into master Jan 20, 2017
@levithomason levithomason deleted the docs/callback-signatures branch January 20, 2017 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant