See the repro. In short, when using subcomponents, I get this error:
src/stories/Header.stories.ts:11:5 - error TS2322: Type '({ primary, size, backgroundColor, label, ...props }: ButtonProps) => JSX.Element' is not assignable
to type 'ComponentType<unknown>'.
Type '({ primary, size, backgroundColor, label, ...props }: ButtonProps) => JSX.Element' is not assignable to type 'FunctionComponent<unknown>'.
Types of parameters '__0' and 'props' are incompatible.
Type 'unknown' is not assignable to type 'ButtonProps'.
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.