Addon-docs: Doesn't render values within objects
See original GitHub issueDescribe the bug
This is my code:
GridContainer.tsx
import React, { ReactNode } from 'react';
import { grid } from './variables';
import { Container } from './Grid.styles';
interface GridContainerProps {
children: ReactNode;
columns?: number;
gutter?: number;
}
const GridContainer = ({ children, columns, gutter }: GridContainerProps) => {
return (
<Container columns={columns} gutter={gutter}>
{children}
</Container>
);
};
GridContainer.defaultProps = {
columns: grid.numberOfColumns,
gutter: grid.gutter,
};
export default GridContainer;
variables.ts
const grid = {
numberOfColumns: 12,
gutter: 24,
};
...
export { grid, .... };
And this is the generated doc table
Expected behavior
Print grid
object value in the “default” column
System: OS: macOS 10.15.4 CPU: (12) x64 Intel® Core™ i7-9750H CPU @ 2.60GHz Binaries: Node: 12.18.1 - ~/.asdf/installs/nodejs/12.18.1/bin/node Yarn: 1.22.4 - ~/.asdf/installs/nodejs/12.18.1/.npm/bin/yarn Browsers: Chrome: 83.0.4103.116 npmPackages: @storybook/addon-actions: 5.3.19 => 5.3.19 @storybook/addon-docs: 5.3.19 => 5.3.19 @storybook/addon-knobs: 5.3.19 => 5.3.19 @storybook/addon-links: 5.3.19 => 5.3.19 @storybook/addon-storysource: 5.3.19 => 5.3.19 @storybook/addons: 5.3.19 => 5.3.19 @storybook/preset-create-react-app: 3.0.1 => 3.0.1 @storybook/preset-typescript: 3.0.0 => 3.0.0 @storybook/react: 5.3.19 => 5.3.19
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:10 (6 by maintainers)
Top GitHub Comments
PR is up now! https://github.com/styleguidist/react-docgen-typescript/pull/286
This doesn’t solve for defaults stored in another file. but i’ll wait til the next issue to fix that ;P
Thanks for upgrading. I’ll give it a look during the RC period!