react-docgen icon indicating copy to clipboard operation
react-docgen copied to clipboard

Using `Readonly<T>` utility type results in losing pieces of `T`'s information

Open federico-ntr opened this issue 11 months ago • 0 comments

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.

federico-ntr avatar Mar 21 '24 17:03 federico-ntr