Skip to content

Commit

Permalink
Merge pull request #33 from ComponentDriven/16843-relax-TArgs-to-only…
Browse files Browse the repository at this point in the history
…-apply-to-args

Only make `TArgs` parameterize `args` and `argTypes` in our default annotations
  • Loading branch information
shilman authored Dec 15, 2021
2 parents 87bc651 + 85efd3c commit 835a408
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/story.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export type BaseAnnotations<TFramework extends AnyFramework = AnyFramework, TArg
* Decorators defined in Meta will be applied to every story variation.
* @see [Decorators](https://storybook.js.org/docs/addons/introduction/#1-decorators)
*/
decorators?: DecoratorFunction<TFramework, TArgs>[];
decorators?: DecoratorFunction<TFramework, Args>[];

/**
* Custom metadata for a story.
Expand All @@ -168,28 +168,23 @@ export type BaseAnnotations<TFramework extends AnyFramework = AnyFramework, TArg
* Asynchronous functions which provide data for a story.
* @see [Loaders](https://storybook.js.org/docs/react/writing-stories/loaders)
*/
loaders?: LoaderFunction<TFramework, TArgs>[];
loaders?: LoaderFunction<TFramework, Args>[];

/**
* Define a custom render function for the story(ies). If not passed, a default render function by the framework will be used.
*/
render?: ArgsStoryFn<TFramework, TArgs>;

/**
* Function that is executed after the story is rendered.
*/
play?: PlayFunction<TFramework, TArgs>;
render?: ArgsStoryFn<TFramework, Args>;
};

export type ProjectAnnotations<
TFramework extends AnyFramework = AnyFramework,
TArgs = Args
> = BaseAnnotations<TFramework, TArgs> & {
argsEnhancers?: ArgsEnhancer<TFramework, TArgs>[];
argTypesEnhancers?: ArgTypesEnhancer<TFramework, TArgs>[];
argsEnhancers?: ArgsEnhancer<TFramework, Args>[];
argTypesEnhancers?: ArgTypesEnhancer<TFramework, Args>[];
globals?: Globals;
globalTypes?: GlobalTypes;
applyDecorators?: DecoratorApplicator<TFramework, TArgs>;
applyDecorators?: DecoratorApplicator<TFramework, Args>;
};

type StoryDescriptor = string[] | RegExp;
Expand Down Expand Up @@ -265,7 +260,7 @@ export type ComponentAnnotations<
*
* By defining them each component will have its tab in the args table.
*/
subcomponents?: Record<string, TFramework['component']>;
subcomponents?: Record<string, TFramework['component']>;
};

export type StoryAnnotations<
Expand All @@ -281,6 +276,11 @@ export type StoryAnnotations<
* Override the display name in the UI (CSF v2)
*/
storyName?: StoryName;

/**
* Function that is executed after the story is rendered.
*/
play?: PlayFunction<TFramework, TArgs>;

/** @deprecated */
story?: Omit<StoryAnnotations<TFramework, TArgs>, 'story'>;
Expand Down

0 comments on commit 835a408

Please sign in to comment.