diff --git a/lib/addons/src/types.ts b/lib/addons/src/types.ts index dc1627b0f849..559fe5a72122 100644 --- a/lib/addons/src/types.ts +++ b/lib/addons/src/types.ts @@ -197,6 +197,14 @@ export interface BaseAnnotations { * @see [Decorators](https://storybook.js.org/docs/addons/introduction/#1-decorators) */ decorators?: BaseDecorators; + /** + * Define a custom render function for the story(ies). If not passed, a default render function by the framework will be used. + */ + render?: (args: Args, context: StoryContext) => StoryFnReturnType; + /** + * Function that can be executed after the story is rendered. + */ + play?: Function; } export interface Annotations @@ -263,11 +271,17 @@ export interface BaseMeta { subcomponents?: Record; } -export interface BaseStory { - (args: Args, context: StoryContext): StoryFnReturnType; - +type BaseStoryObject = { /** * Override the display name in the UI */ storyName?: string; -} +}; + +type BaseStoryFn = { + (args: Args, context: StoryContext): StoryFnReturnType; +}; + +export type BaseStory = + | BaseStoryFn + | BaseStoryObject;