better-docs icon indicating copy to clipboard operation
better-docs copied to clipboard

Not displaying React propTypes isRequired in the document

Open smarajitdasgupta opened this issue 5 years ago • 1 comments

Tried the sample react component with proptypes. The example gets generated fine but required is 'No' even if isRequired is added to proptype.

Screen Shot 2020-03-03 at 9 39 17 pm

`/**

  • Some documented component
  • @component
  • @example
  • const text = 'some example text'
  • return (
  • ) */ const Documented = (props) => { const { text } = props return (
    {text}
    ) }

Documented.propTypes = { /** * Text is a text */ text: PropTypes.string.isRequired, }

export default Documented`

This is my config

{ "tags": { "allowUnknownTags": true, "dictionaries": ["jsdoc"] }, "source": { "include": ["src"], "includePattern": ".+\\.js(doc|x)?$", "excludePattern": "(^|\\/|\\\\)_" }, "plugins": [ "plugins/markdown", "node_modules/better-docs/component", "node_modules/better-docs/category" ], "templates": { "better-docs": { "name": "My React components" } }, "opts": { "destination": "docs", "encoding": "utf8", "recurse": true, "verbose": true, "readme": "README.md", "template": "node_modules/better-docs/" } }

smarajitdasgupta avatar Mar 03 '20 07:03 smarajitdasgupta

Did you ever find a solution for this? I am facing the same problem, I just set JSDoc and better-docs up in my react app. And when I set up the first component, it showed it correctly, but now that I was in the process of making docs for the rest of the components, I noticed that the isRequired always says 'No'. Even on the first component where I saw it say 'Yes' in the beginning.

AnthonMS avatar Oct 20 '21 13:10 AnthonMS