Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

type: update Addon_BaseAnnotations type #22771

Merged
10 changes: 7 additions & 3 deletions code/lib/types/src/modules/addons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,11 @@ export type Addon_BaseDecorators<StoryFnReturnType> = Array<
(story: () => StoryFnReturnType, context: Addon_StoryContext) => StoryFnReturnType
>;

export interface Addon_BaseAnnotations<TArgs, StoryFnReturnType> {
export interface Addon_BaseAnnotations<
TArgs,
StoryFnReturnType,
TRenderer extends Renderer = Renderer
> {
/**
* Dynamic data that are provided (and possibly updated by) Storybook and its addons.
* @see [Arg story inputs](https://storybook.js.org/docs/react/api/csf#args-story-inputs)
Expand Down Expand Up @@ -192,12 +196,12 @@ export interface Addon_BaseAnnotations<TArgs, StoryFnReturnType> {
/**
* Define a custom render function for the story(ies). If not passed, a default render function by the framework will be used.
*/
render?: (args: TArgs, context: Addon_StoryContext) => StoryFnReturnType;
render?: (args: TArgs, context: Addon_StoryContext<TRenderer>) => StoryFnReturnType;

/**
* Function that is executed after the story is rendered.
*/
play?: (context: Addon_StoryContext) => Promise<void> | void;
play?: (context: Addon_StoryContext<TRenderer>) => Promise<void> | void;
}

export interface Addon_Annotations<TArgs, StoryFnReturnType>
Expand Down