@defaultValue is not parsed from interface
supersnager opened this issue · comments
Super Snager commented
The following code tested in the playgroud https://react-docgen.dev/playground
interface Props {
/**
* The name to greet
*
* @defaultValue 'something'
*/
name: string;
}
/**
* Hello world component
*/
const MyComponent = (props: Props) => {
return <div />;
}
returns:
[
{
"description": "Hello world component",
"displayName": "MyComponent",
"methods": [],
"props": {
"name": {
"required": true,
"tsType": {
"name": "string"
},
"description": "The name to greet\n\n@defaultValue 'something'"
}
}
}
]
I think the defaultValue property is missing and should appear in the result, and part of the description "@DefaultValue 'something'" should be removed.
[
{
"description": "Hello world component",
"displayName": "MyComponent",
"methods": [],
"props": {
"name": {
"required": true,
"tsType": {
"name": "string"
},
"description": "The name to greet",
"defaultValue": {
"value": "'something'",
"computed": false
}
}
}
}
]
Thomas Schulz commented
Watching this issue 👀
I'm using Storybook v.8.x
for React components, component and prop documentation follows TSDoc syntax.