csf icon indicating copy to clipboard operation
csf copied to clipboard

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

Open lburgess opened this issue 1 year ago • 2 comments

I believe that this fixes the underlying bug for the much discussed bug in Storybook: https://github.com/storybookjs/storybook/issues/23170

lburgess avatar Aug 12 '24 11:08 lburgess

Hi ! When is this PR going to be merged ?

BryanBerger98 avatar Oct 15 '24 14:10 BryanBerger98

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

lburgess avatar Oct 16 '24 14:10 lburgess

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.

penx avatar Dec 02 '24 17:12 penx

@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.

JReinhold avatar Dec 22 '24 11:12 JReinhold

:rocket: PR was released in v0.1.13 :rocket:

github-actions[bot] avatar Dec 24 '24 09:12 github-actions[bot]