reactjs / reactjs/react-docgen
The enum value of oneOf doesn't recognize description.
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 3.8k
- Forks
- 316
- Avg merge
- 5h 7m
- Merged PRs (30d)
- 4
Description
Hi,react-docgen does't recognize description for oneOf enum value.Sometimes enum value will make people so confused.It's good to show the comment in description.
Example Component
import React, { Component } from 'react'
import PropTypes from 'prop-types'
class Box extends Component {
render() {
return <div>box</div>
}
}
Box.propTypes = {
/** 排列 */
flexDirection: PropTypes.oneOf([
/** 横向 */
'row',
/** 纵向 */
'column',
]),
}
export default Box;
Output Docgen
The comment "横向, 纵向" doesn't show in description.
{
"description": "",
"displayName": "Box",
"methods": [],
"props": {
"name": {
"flexDirection": {
"defaultValue": {
"value": "'column'",
"computed": false
},
"type": {
"name": "enum",
"value": [{
"value": "'row'",
"computed": false
}, {
"value": "'column'",
"computed": false
}]
},
"required": false,
"description": "排列"
}
}
}
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reported Box component and its PropTypes.oneOf example, then compare the generated JSON with the inline comments on each enum value. Trace how oneOf values are represented and confirm that the output includes their descriptions while preserving the prop-level description. Done means the documented example produces descriptions for both “row” and “column”.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- documentation
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100