react-docgen
react-docgen copied to clipboard
Using `Readonly<T>` utility type results in losing pieces of `T`'s information
You can paste the code below in the playground and see that description
and tsType
are lost.
interface Props {
/** The name to greet */
name: string
}
/**
* Hello world component
*/
const MyComponent = ({name = 'world'}: Props) => {
return <div />;
}
/**
* Hello world Readonly
*/
const MyReadonlyPropsComponent = ({name = 'world'}: Readonly<Props>)=> {
return <div />;
}
I noticed this behaviour while digging through an issue that appeared after the latest Storybook's major update, which uses this package by default to extract information from the components.