From 5ff27ce372a690292a01a94612a70e1d130d9315 Mon Sep 17 00:00:00 2001 From: Matthijs Groen Date: Tue, 16 Dec 2025 21:27:37 +0100 Subject: [PATCH 1/3] Add type definition for PagePropsAndCustomArgs Updated the documentation to include the proper type for CSF Next, so that the footer becomes a known type to the story --- docs/_snippets/page-story-slots.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/_snippets/page-story-slots.md b/docs/_snippets/page-story-slots.md index eb68bff6ae67..410e1c7085ae 100644 --- a/docs/_snippets/page-story-slots.md +++ b/docs/_snippets/page-story-slots.md @@ -273,9 +273,11 @@ import preview from '../.storybook/preview'; import { Page } from './Page'; +type PagePropsAndCustomArgs = React.ComponentProps & { footer?: string } + const meta = preview.meta({ component: Page, - render: ({ footer, ...args }) => ( + render: ({ footer, ...args }: PagePropsAndCustomArgs) => (
{footer}
From c4f665c4435fe86e8cb4264123b56254f73c55d4 Mon Sep 17 00:00:00 2001 From: Matthijs Groen Date: Wed, 24 Dec 2025 10:12:31 +0100 Subject: [PATCH 2/3] Update docs/_snippets/page-story-slots.md Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- docs/_snippets/page-story-slots.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/_snippets/page-story-slots.md b/docs/_snippets/page-story-slots.md index 410e1c7085ae..731cde2b49d1 100644 --- a/docs/_snippets/page-story-slots.md +++ b/docs/_snippets/page-story-slots.md @@ -273,7 +273,7 @@ import preview from '../.storybook/preview'; import { Page } from './Page'; -type PagePropsAndCustomArgs = React.ComponentProps & { footer?: string } +type PagePropsAndCustomArgs = React.ComponentProps & { footer?: string }; const meta = preview.meta({ component: Page, From 00a3594677e9b514a493a55b33d17f0bfd5843db Mon Sep 17 00:00:00 2001 From: Matthijs Groen Date: Fri, 26 Dec 2025 21:50:32 +0100 Subject: [PATCH 3/3] Apply code review suggestion Added comment and make type multi-line --- docs/_snippets/page-story-slots.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/_snippets/page-story-slots.md b/docs/_snippets/page-story-slots.md index 731cde2b49d1..d0422e89f244 100644 --- a/docs/_snippets/page-story-slots.md +++ b/docs/_snippets/page-story-slots.md @@ -273,7 +273,11 @@ import preview from '../.storybook/preview'; import { Page } from './Page'; -type PagePropsAndCustomArgs = React.ComponentProps & { footer?: string }; +// Defines a custom type that combines the component props with custom story args to prevent type errors in the render function +// This is optional, but helps with type safety as args are inferred automatically in CSF Next +type PagePropsAndCustomArgs = React.ComponentProps & { + footer?: string; +}; const meta = preview.meta({ component: Page,