diff --git a/code/renderers/react/src/public-types.test.tsx b/code/renderers/react/src/public-types.test.tsx index c955c6b59fb2..8dd1a8a9f5f3 100644 --- a/code/renderers/react/src/public-types.test.tsx +++ b/code/renderers/react/src/public-types.test.tsx @@ -228,3 +228,49 @@ test('StoryObj is allowed when all arguments are optional', () => { test('Meta can be used without generic', () => { expectTypeOf({ component: Button }).toMatchTypeOf(); }); + +test('Props can be defined as interfaces, issue #21768', () => { + interface Props { + label: string; + } + + const Component = ({ label }: Props) => <>{label}; + + const withDecorator: Decorator = (Story) => ( + <> + + + ); + + const meta = { + component: Component, + args: { + label: 'label', + }, + decorators: [withDecorator], + } satisfies Meta; + + const Basic: StoryObj = {}; + + type Expected = ReactStory>; + expectTypeOf(Basic).toEqualTypeOf(); +}); + +test('Components without Props can be used, issue #21768', () => { + const Component = () => <>Foo; + const withDecorator: Decorator = (Story) => ( + <> + + + ); + + const meta = { + component: Component, + decorators: [withDecorator], + } satisfies Meta; + + const Basic: StoryObj = {}; + + type Expected = ReactStory<{}, {}>; + expectTypeOf(Basic).toEqualTypeOf(); +}); diff --git a/code/yarn.lock b/code/yarn.lock index 636d8772599a..db906dd0f7bc 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -6176,11 +6176,11 @@ __metadata: linkType: hard "@storybook/csf@npm:next": - version: 0.0.2-next.10 - resolution: "@storybook/csf@npm:0.0.2-next.10" + version: 0.0.2-next.11 + resolution: "@storybook/csf@npm:0.0.2-next.11" dependencies: type-fest: ^2.19.0 - checksum: a46deb02d9899b1d85e8fed3bfcdde4368fb8220fd8d78e090046e891241cfa0f294c91687d0ac592c7d8036f1294be8874fab14f11ecabe255659272047c961 + checksum: fa4025ff520fcfc6eaf9bb9cabbf11d5c06d6ae7ec91bd8102f8f32505ca9149b305e55cd151789a18c1ddee69fe6997293aeff20dcc8c28b6f09833c98a8831 languageName: node linkType: hard