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

fix: story ComponentAnnotations['subcomponents'] to correctly use its own type for subcomponents rather than attempt to inherit from the component #103

Conversation

lburgess
Copy link
Contributor

@lburgess lburgess commented Aug 12, 2024

I believe that this fixes the underlying bug for the much discussed bug in Storybook:
storybookjs/storybook#23170

Version

Published prerelease version: v0.1.13-next.0

Changelog

🐛 Bug Fix

  • fix: story ComponentAnnotations['subcomponents'] to correctly use its own type for subcomponents rather than attempt to inherit from the component #103 (@lburgess)

Authors: 1

… own type for subcomponents rather than attempt to inherit from the component
@BryanBerger98
Copy link

Hi ! When is this PR going to be merged ?

@lburgess
Copy link
Contributor Author

@starzje Is there another maintainer you can nudge to review this? Many thanks!

@penx
Copy link

penx commented Dec 2, 2024

LGTM

The ComponentAnnotations.component type is:

  component?: (TRenderer & {
    T: Record<string, unknown> extends Required<TArgs> ? any : TArgs;
  })['component'];

So, as Required<TArgs> don't apply to subcomponents, changing subcomponents to

  subcomponents?: Record<string, (TRenderer & { T: any })['component']>;

...to match, looks like the right way to go.

@JReinhold
Copy link

@kasperpeulen this seems like something that you would know about, could you review.

For context, subcomponents is only used for the Controls/ArgTypes table, and doesn't have any impact on what a story actually renders.

@kasperpeulen kasperpeulen merged commit b832db2 into ComponentDriven:next Dec 24, 2024
Copy link

🚀 PR was released in v0.1.13 🚀

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

Successfully merging this pull request may close these issues.

7 participants