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

[Bug]: Autodocs "union" type #25305

Open
markokos01 opened this issue Dec 22, 2023 · 7 comments
Open

[Bug]: Autodocs "union" type #25305

markokos01 opened this issue Dec 22, 2023 · 7 comments

Comments

@markokos01
Copy link

markokos01 commented Dec 22, 2023

Describe the bug

I have defined some props on the component with union. For example:

export interface MyComponentProps { title: string; subtitle?: string | undefined; }

I wrote a story for my component, added "autodocs" to tags and Storybook generated controls but for prop subtitle I got type union. I expected to see string | undefined.

To Reproduce

Add prop type for example string | undefined.

System

storybook: 7.6.5
@storybook/vue3: 7.6.5
@storybook/vue3-vite: 7.6.5

Additional context

No response

@larsrickert
Copy link
Contributor

Hey, this will be fixed with #22285

@larsrickert
Copy link
Contributor

Fixed with #22285 in version 8

@Jan-IaMe
Copy link

Jan-IaMe commented Apr 9, 2024

Hi @larsrickert , this seems to be still a problem in React/Typescript/Vite. I'm using the latest version of storybook (v8.0.6).

@larsrickert
Copy link
Contributor

@janitza-IaMe React and Vue use completely different docgen plugins :) @storybookjs/core not sure who is responsible for react?

@larsrickert larsrickert added react and removed vue3 labels Apr 9, 2024
@IanVS
Copy link
Member

IanVS commented Apr 9, 2024

@janitza-IaMe the default docgen for react is now react-docgen, which is faster, but not as fully-featured. See https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#react-docgen-component-analysis-by-default to find out how to use the previous default, react-docgen-typescript instead.

@Jan-IaMe
Copy link

I use react-docgen and it has this problem.

@IanVS
Copy link
Member

IanVS commented Apr 10, 2024

@Jan-IaMe yes that is an expected limitation of react-docgen.

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

No branches or pull requests

6 participants