The enum value of oneOf doesn't recognize description.
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- react, typescript
- Domain
- documentation
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.
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": "排列"
}
}
}
}
- Dominant language
- TypeScript
- Stars
- 3.8k
- Forks
- 316
- Avg merge
- 3h 28m
- Merged PRs (30d)
- 6
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.
More from reactjs/react-docgen
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
reactjs/react-docgen#1102 ·
-
Typescript Status Open
Difficulty 5/5 Over a week Newbie friendliness 20/100
reactjs/react-docgen#1005 · 4 reactions ·
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
reactjs/react-docgen#997 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 42/100
reactjs/react-docgen#994 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
reactjs/react-docgen#982 · 2 comments ·
All issues in reactjs/react-docgen
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
ontola/atomic-server#1625 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
melgarafael/DeskcommCRM#1451 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
-
bug via-triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bot:ai-assisted component:compact-js status:untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
midnightntwrk/midnight-sdk#403 ·