Storybook: Docs isn't documenting children props without a comment

Created on 11 Sep 2020  路  5Comments  路  Source: storybookjs/storybook

description

Dependency @styleguidist/react-docgen-typescript has the behavior of not documenting children property if it has no comment. See the linked issue and PR. It's unclear if it will be fixed in that package, and if so, Storybook may need to either:

  1. replace the dependency with another option
  2. add the configuration option
  3. update documentation to warn users about this behavior

https://github.com/styleguidist/react-docgen-typescript/issues/284
https://github.com/styleguidist/react-docgen-typescript/pull/285

I think this is only effecting users who type their components as below, instead of using React.FC.

export interface MyComponentProps {
...
}
export const MyComponent = (props: MyComponentProps): JSX.Element => {
...
}

workaround

add a comment for the children props that you want documented

notes

I'm mostly submitting this so you all will be aware of it and to help prevent anyone else from wasting hours of their life to find it.

argstable bug typescript

Most helpful comment

I've opened a PR to add a config option that would document the "children" even without a jsDoc comment

https://github.com/styleguidist/react-docgen-typescript/pull/305

Should be resolved in around a week! Will post back here once merged + released

All 5 comments

cc @hipstersmoothie

This is actually the intended behavior. I'd be open to adding a config option for this

Is this because React.FC adds the children type automatically, but not all components actually output children? So not documenting it unless there is a comment is a workaround to provide a way for us to control on a component-by-component basis (when all components are typed with React.FC) whether children is documented or not?

If so, could you limit the application of this rule to only apply when the type actually is React.FC?

I'm happy with configuration and/or documentation too though.

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

I've opened a PR to add a config option that would document the "children" even without a jsDoc comment

https://github.com/styleguidist/react-docgen-typescript/pull/305

Should be resolved in around a week! Will post back here once merged + released

Was this page helpful?
0 / 5 - 0 ratings