mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-04 10:11:05 +08:00
Merge pull request #19651 from storybookjs/kasper/fix-storyobj-type
CSF: Fix `StoryObj<typeof Cmp>` to work the same as old ComponentStoryObj
This commit is contained in:
commit
c3d86a2abe
@ -79,7 +79,7 @@ describe('Args can be provided in multiple ways', () => {
|
||||
});
|
||||
|
||||
test('Component can be used as generic parameter for StoryObj', () => {
|
||||
type Expected = ReactStory<ButtonProps, ButtonProps>;
|
||||
type Expected = ReactStory<ButtonProps, Partial<ButtonProps>>;
|
||||
expectTypeOf<StoryObj<typeof Button>>().toEqualTypeOf<Expected>();
|
||||
});
|
||||
});
|
||||
|
@ -53,11 +53,7 @@ export type StoryObj<TMetaOrCmpOrArgs = Args> = TMetaOrCmpOrArgs extends {
|
||||
>
|
||||
: never
|
||||
: TMetaOrCmpOrArgs extends ComponentType<any>
|
||||
? StoryAnnotations<
|
||||
ReactFramework,
|
||||
ComponentProps<TMetaOrCmpOrArgs>,
|
||||
ComponentProps<TMetaOrCmpOrArgs>
|
||||
>
|
||||
? StoryAnnotations<ReactFramework, ComponentProps<TMetaOrCmpOrArgs>>
|
||||
: StoryAnnotations<ReactFramework, TMetaOrCmpOrArgs>;
|
||||
|
||||
type ActionArgs<RArgs> = {
|
||||
|
@ -141,7 +141,7 @@ describe('StoryObj', () => {
|
||||
SvelteStory<
|
||||
Button,
|
||||
{ disabled: boolean; label: string },
|
||||
{ disabled: boolean; label: string }
|
||||
{ disabled?: boolean; label?: string }
|
||||
>
|
||||
>();
|
||||
});
|
||||
|
@ -49,11 +49,7 @@ export type StoryObj<MetaOrCmpOrArgs = Args> = MetaOrCmpOrArgs extends {
|
||||
>
|
||||
: never
|
||||
: MetaOrCmpOrArgs extends SvelteComponentTyped
|
||||
? StoryAnnotations<
|
||||
SvelteFramework<MetaOrCmpOrArgs>,
|
||||
ComponentProps<MetaOrCmpOrArgs>,
|
||||
ComponentProps<MetaOrCmpOrArgs>
|
||||
>
|
||||
? StoryAnnotations<SvelteFramework<MetaOrCmpOrArgs>, ComponentProps<MetaOrCmpOrArgs>>
|
||||
: StoryAnnotations<SvelteFramework, MetaOrCmpOrArgs>;
|
||||
|
||||
export type DecoratorFn<TArgs = Args> = DecoratorFunction<SvelteFramework, TArgs>;
|
||||
|
Loading…
x
Reference in New Issue
Block a user