react-ui icon indicating copy to clipboard operation
react-ui copied to clipboard

Enable generating documentation of advanced `propTypes` syntax

Open bedrich-schindler opened this issue 5 years ago • 1 comments

Added by @adamkudrna: This includes these useful ways of abstraction:

  • propTypes assigned as value of a constant in the same file
  • propTypes defined in another file

Based on issue: https://github.com/doczjs/docz/issues/1431

We need to create documentation component that will allow us to render documentation table with all props and its description. This component should be similar to default docz PropType component, but need to be able to renders props that are composed from another proptype definitions.

I would recommend to move this component to separate repository later, because it seems that there are more people with same problem like we have.

bedrich-schindler avatar May 26 '20 12:05 bedrich-schindler

@adamkudrna @mbohal I spent more that one hour reading and trying to somehow read and parse JS comment blocks, but without success. There are few discussions on StackOverflow telling that there is probably no way how to do it in the browser because comments are not available in the DOM.

The only way is to do it is to read it and parse it in Node environment, create metadata and render it from it. But it is extremelly hard and this is what docz do all together with other tools.

I think that the only option is to push docz team to fix it or try to create pull request that fixes it.

To sum up, there is no easy way out except writing it manually ...

bedrich-schindler avatar Jun 12 '20 12:06 bedrich-schindler

I think that this should be closed as this is no more valid and we are getting rid of TypeScript and prop types in #394

What do you think @mbohal @adamkudrna?

bedrich-schindler avatar Mar 03 '25 15:03 bedrich-schindler