Skip to content
This repository was archived by the owner on Jan 31, 2024. It is now read-only.

Commit abacb7d

Browse files
committed
Fix compose story for new TS types
1 parent 3714e79 commit abacb7d

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { defaultDecorateStory, combineParameters, addons, applyHooks, HooksContext, mockChannel } from '@storybook/preview-api';
2-
import type { Meta, ReactRenderer, Args } from '@storybook/react';
3-
import type { StoryContext } from '@storybook/types';
2+
import type { ReactRenderer, Args } from '@storybook/react';
3+
import type { ComponentAnnotations, StoryContext } from '@storybook/types';
44
import { isExportStory } from '@storybook/csf';
55

6+
export { StoriesWithPartialProps } from './types';
67
import type { GlobalConfig, StoriesWithPartialProps, StoryFile, TestingStory, TestingStoryPlayContext } from './types';
78
import { getStoryName, globalRender, isInvalidStory, objectEntries } from './utils';
89

@@ -63,7 +64,7 @@ export function setGlobalConfig(config: GlobalConfig) {
6364
*/
6465
export function composeStory<GenericArgs extends Args>(
6566
story: TestingStory<GenericArgs>,
66-
meta: Meta<GenericArgs | any>,
67+
meta: ComponentAnnotations<ReactRenderer>,
6768
globalConfig: GlobalConfig = globalStorybookConfig
6869
) {
6970

src/types.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { Addon_BaseStoryFn as OriginalBaseStoryFn, BaseAnnotations, ProjectAnnotations, StoryContext, Args } from '@storybook/types';
2-
import type { StoryFn as OriginalStoryFn, StoryObj, Meta, ReactRenderer } from '@storybook/react';
1+
import type { Addon_BaseStoryFn as OriginalBaseStoryFn, BaseAnnotations, ProjectAnnotations, StoryContext, Args, StoryAnnotations, AnnotatedStoryFn } from '@storybook/types';
2+
import type { StoryFn as OriginalStoryFn, Meta, ReactRenderer } from '@storybook/react';
33
import type { ReactElement } from 'react';
44

55
type StoryFnReactReturnType = ReactElement<unknown>;
@@ -13,7 +13,7 @@ export type BaseStoryFn<Args> = OriginalBaseStoryFn<Args, StoryFnReactReturnType
1313
*/
1414
export type GlobalConfig = ProjectAnnotations<ReactRenderer>;
1515

16-
export type TestingStory<T = Args> = StoryFn<T> | StoryObj<T>;
16+
export type TestingStory<T = Args> = AnnotatedStoryFn<ReactRenderer, T> | StoryAnnotations<ReactRenderer, T>;
1717

1818
export type StoryFile = { default: Meta<any>, __esModule?: boolean }
1919

0 commit comments

Comments
 (0)