Open c-vetter opened 5 months ago
Any update on this?
The issue seems to come from the [ReactRenderer
type].(https://github.com/storybookjs/storybook/blob/next/code/renderers/react/src/types.ts#L8)
Maybe we should do the same as in SvelteRenderer
and fallback to any
?
export interface ReactRenderer extends WebRenderer {
component: ComponentType<this['T'] extends undefined ? any : this['T']>;
storyResult: StoryFnReactReturnType;
mount: (ui?: JSX.Element) => Promise<Canvas>;
}
or
export interface ReactRenderer extends WebRenderer {
component: ComponentType<this['T'] extends Record<string, any> ? this['T'] : any>;
storyResult: StoryFnReactReturnType;
mount: (ui?: JSX.Element) => Promise<Canvas>;
}
Note: I'm really not familiar with this this['T']
pattern in TypeScript (introduced with this CSF3 change, cf. @storybook/csf
).
Edit: this will be fixed if https://github.com/ComponentDriven/csf/pull/103 is merged.
Describe the bug
See the repro. In short, when using subcomponents, I get this error:
Reproduction link
https://github.com/c-vetter/repro_storybook_subcomponents-type-error
Reproduction steps
npx storybook init
System
Additional context
Looking for a solution, I came across #21253
By updating that one's repro, I was able to get it to work: https://github.com/c-vetter/repro_storybook_subcomponents-type-error/tree/alt/21253
I'm unsure as to what is the relevant difference, will update here with any findings.