From df716fa21d96d07a831675b716371541a678bb0f Mon Sep 17 00:00:00 2001 From: Edoardo Dusi Date: Mon, 16 Dec 2024 18:53:58 +0100 Subject: [PATCH] fix: allow custom props in StoryblokComponent, Story, and ServerComponent types --- src/__tests__/testing-components/TestUseStoryblok.tsx | 2 +- src/common/storyblok-component.tsx | 4 ++-- src/rsc/server-component.tsx | 4 ++-- src/rsc/story.tsx | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/__tests__/testing-components/TestUseStoryblok.tsx b/src/__tests__/testing-components/TestUseStoryblok.tsx index 74d00e64..32889eb7 100644 --- a/src/__tests__/testing-components/TestUseStoryblok.tsx +++ b/src/__tests__/testing-components/TestUseStoryblok.tsx @@ -24,7 +24,7 @@ const TestUseStoryblok = ({ return
Loading...
; } - return ; + return ; }; export default TestUseStoryblok; diff --git a/src/common/storyblok-component.tsx b/src/common/storyblok-component.tsx index 3b8f48bc..e8946192 100644 --- a/src/common/storyblok-component.tsx +++ b/src/common/storyblok-component.tsx @@ -6,12 +6,12 @@ import { } from './index'; import type { SbBlokData } from '@/types'; -interface StoryblokComponentProps { +interface StoryblokComponentProps extends Omit, 'blok'> { blok: SbBlokData; } const StoryblokComponent = forwardRef( - ({ blok, ...restProps }, ref) => { + ({ blok, ...restProps }: StoryblokComponentProps, ref) => { if (!blok) { console.error( 'Please provide a \'blok\' property to the StoryblokComponent', diff --git a/src/rsc/server-component.tsx b/src/rsc/server-component.tsx index 1fef1d2d..02baccd7 100644 --- a/src/rsc/server-component.tsx +++ b/src/rsc/server-component.tsx @@ -6,12 +6,12 @@ import { } from './index'; import type { SbBlokData } from '@/types'; -interface SbServerComponentProps { +interface SbServerComponentProps extends Omit, 'blok'> { blok: SbBlokData; } const StoryblokServerComponent = forwardRef( - ({ blok, ...restProps }, ref) => { + ({ blok, ...restProps }: SbServerComponentProps, ref) => { if (!blok) { console.error( 'Please provide a \'blok\' property to the StoryblokComponent', diff --git a/src/rsc/story.tsx b/src/rsc/story.tsx index be0d5606..6a9fffff 100644 --- a/src/rsc/story.tsx +++ b/src/rsc/story.tsx @@ -3,13 +3,13 @@ import type { ISbStoryData, StoryblokBridgeConfigV2 } from '@/types'; import { StoryblokServerComponent } from './common'; import StoryblokLiveEditing from './live-editing'; -interface StoryblokStoryProps { +interface StoryblokStoryProps extends Omit, 'story' | 'bridgeOptions'> { story: ISbStoryData; bridgeOptions?: StoryblokBridgeConfigV2; } const StoryblokStory = forwardRef( - ({ story, bridgeOptions, ...restProps }, ref) => { + ({ story, bridgeOptions, ...restProps }: StoryblokStoryProps, ref) => { if (!story) { console.error( 'Please provide a \'story\' property to the StoryblokServerComponent',