@values doesn't support objects, causes error
See original GitHub issueCurrent behavior
The @values tag works fine if you give it a space separated list of scalar values, like this:
@values sm, medium, large, inherit
However, if you try and use an object literal, it causes the styleguide to not render and display an error. These variations all fail:
@values
{
type: 'String',
thing: 'String',
operation: 'String'
}
@values {
type: 'String',
thing: 'String',
operation: 'String'
}
@values { type: 'String', thing: 'String', operation: 'String' }
These produces the following error instead of showing the styleguide:
TypeError: Reduce of empty array with no initial value
in TableRenderer (created by Styled(Table))
in Styled(Table) (created by PropsRenderer)
in PropsRenderer (created by Styled(Props))
in Styled(Props) (created by Usage)
in div (created by Usage)
in Usage (created by Slot)
in div (created by Slot)
in Slot (created by ReactComponent)
in div (created by ReactComponentRenderer)
in div (created by ReactComponentRenderer)
in div (created by ReactComponentRenderer)
in ReactComponentRenderer (created by Styled(ReactComponent))
in Styled(ReactComponent) (created by ReactComponent)
in ReactComponent (created by VsgReactComponent)
in VsgReactComponent (created by Styled(VsgReactComponent))
in Styled(VsgReactComponent) (created by Components)
in div (created by ComponentsRenderer)
in ComponentsRenderer (created by Components)
in Components (created by Section)
in section (created by SectionRenderer)
in SectionRenderer (created by Styled(Section))
in Styled(Section) (created by Section)
in Section (created by Sections)
in section (created by SectionsRenderer)
in SectionsRenderer (created by Styled(Sections))
in Styled(Sections) (created by Sections)
in Sections (created by Section)
in section (created by SectionRenderer)
in SectionRenderer (created by Styled(Section))
in Styled(Section) (created by Section)
in Section (created by Sections)
in section (created by SectionsRenderer)
in SectionsRenderer (created by Styled(Sections))
in Styled(Sections) (created by Sections)
in Sections (created by StyleGuide)
in main (created by StyleGuideRenderer)
in div (created by StyleGuideRenderer)
in StyleGuideRenderer (created by Styled(StyleGuide))
in Styled(StyleGuide) (created by StyleGuide)
in StyleGuide
This may be due to an error in a component you are overriding, or a bug in React Styleguidist.
If you believe this is a bug, please submit an issue.
Expected behaviour
I would be nice if this just worked, putting the object literal in the values column, or failing that, to produce a better error message - took me a while to track this one down. Alternatively, if this isn’t supported, the docs should say so. If that’the case, I’ll add this to #869 (I’m finally working on that now.)
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Uncaught TypeError: Object.values is not a function JavaScript
Now when I try to create an array from the values... var labels = Object.values(countries);. I get this error: Uncaught TypeError: Object ...
Read more >Object Doesn't Support this Property or Method - Microsoft Learn
The "object doesn't support this property or method" error occurs when you try to use a method or property that the specified object...
Read more >How to fix the 'Object doesn't support this property or method ...
FIrst - what the error message means - It means that the object doesn't have a property(field/attribute/variable) or method(function) by that name at...
Read more >How to Fix TypeError: Null is Not an Object in JavaScript
The JavaScript error TypeError: null is not an object occurs when a property is accessed or a method is called on a null...
Read more >Understanding the "Objects are not valid as a react child" Error ...
The motives for this error to be thrown are the diverse possible scenarios for rendering an object, and, allowing the developer to address...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Hello, it would really be nice as well if this will be supported as well. This helps the ide format the docblock instead of having the first /** and the last */
example
Might be better if there’s an official way to document props /data that are object
I need to tell the user what values and properties the object can accept and how it will perform
Thank you
I’ll do my best, although it may take me a while to get to it.