Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
federico-ntr opened this issue Mar 21, 2024 · 0 comments

Comments

@federico-ntr
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant