better-docs
better-docs copied to clipboard
How to document complex prop-types and display the correct data type?
When I try to document the following prop:
/**
* Form fields inputs
*/
inputs: PropTypes.arrayOf(
PropTypes.shape({
id: PropTypes.string,
name: PropTypes.string,
placeholder: PropTypes.string,
type: PropTypes.string,
data: PropTypes.arrayOf(
PropTypes.shape({
value: PropTypes.string,
label: PropTypes.string
})
)
})
).isRequired
The generated document displays this:
I believe this is not correct, The result should be Array
, Array.<Object>
, etc.. How to tweak this or customize the scripts? Because I can't find it anywhere.
Even if you just have a single shape, the result is insufficient. For example,
StudienDetails.propTypes = {
studie: PropTypes.shape({
studienleitername: PropTypes.string,
studienleiteremail: PropTypes.string,
studienstunden: PropTypes.number,
startdatum: PropTypes.instanceOf(Date),
enddatum: PropTypes.instanceOf(Date),
kriterien: PropTypes.string,
details: PropTypes.string,
}),
}
displays
Name | Type | Required | Description | Default |
---|---|---|---|---|
studie |
shape | No |
I have the same problem