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

Handle unknown proptypes #91

Merged
merged 7 commits into from
Mar 2, 2016
Merged

Handle unknown proptypes #91

merged 7 commits into from
Mar 2, 2016

Conversation

karlbright
Copy link
Contributor

Fixes #77.

image

This ensures that any prop that is assigned via getDefaultProps but missing from propTypes will be shown as an unknown prop type.

Although this is bad practice in React, I think it's probably best to display the style guide rather than throw and error for this, and ensure that the user can find out the explanation behind unknown proptypes in the styleguide readme.

@mik01aj
Copy link
Collaborator

mik01aj commented Mar 2, 2016

LGTM. I like the idea of displaying unknown. I also looked at the code and it seems fine.

@sapegin: Merge?

@karlbright
Copy link
Contributor Author

@mik01aj Good call. I was meant to go back and fix those up and completely forgot 👍

@@ -11,6 +11,8 @@ export let Code = ({ className = '', children }) => {
return <code className={sMarkdown.code + ' ' + className}>{children}</code>;
};

export let UnknownPropType = () => <span>unknown</span>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to export it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is actually no longer required, have removed this now.

@sapegin
Copy link
Member

sapegin commented Mar 2, 2016

Just two comments from me, otherwise I really like this. Thanks @karlbright!

@karlbright
Copy link
Contributor Author

All sorted.

sapegin added a commit that referenced this pull request Mar 2, 2016
@sapegin sapegin merged commit 9c9f091 into styleguidist:master Mar 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants