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(Popup): make allowed content types statically analyzable #990

Merged
merged 1 commit into from
Dec 6, 2016

Conversation

dvdzkwsk
Copy link
Member

@dvdzkwsk dvdzkwsk commented Dec 6, 2016

This is presumably an issue with all propType definitions that reuse propTypes defined in another variable. I traced it down to react-docgen being unable to parse the union type because it viewed it as dynamic, which is technically true because that type definition is referenced from a variable and as such the propType is resolved at runtime.

Before

screen shot 2016-12-05 at 9 42 50 pm

After

screen shot 2016-12-05 at 9 40 50 pm

@@ -21,7 +21,6 @@ const _meta = {
name: 'Popup',
type: META.TYPES.MODULE,
props: {
content: [PropTypes.string, PropTypes.node],
Copy link
Member Author

Choose a reason for hiding this comment

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

Also this looked to be in error, since it is not an enum but a propType.

@codecov-io
Copy link

codecov-io commented Dec 6, 2016

Current coverage is 99.73% (diff: 100%)

Merging #990 into master will not change coverage

@@             master       #990   diff @@
==========================================
  Files           140        140          
  Lines          2304       2304          
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
  Hits           2298       2298          
  Misses            6          6          
  Partials          0          0          

Powered by Codecov. Last update fa9175a...b35fa51

@levithomason
Copy link
Member

Yikes, thanks. Since node is "anything that can be rendered" it includes string, so we can actually simplify this to PropTypes.node. React PropTypes docs:

// Anything that can be rendered: numbers, strings, elements or an array
// (or fragment) containing these types.
optionalNode: React.PropTypes.node,

@dvdzkwsk
Copy link
Member Author

dvdzkwsk commented Dec 6, 2016

Good call, was not even paying attention to the types to be honest. Patch incoming.

@dvdzkwsk
Copy link
Member Author

dvdzkwsk commented Dec 6, 2016

Pushed and renamed commit accordingly

@levithomason
Copy link
Member

Thanks will merge on pass.

@levithomason
Copy link
Member

Released in semantic-ui-react@0.62.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants