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

Only make TArgs parameterize args and argTypes in our default annotations #33

Merged
merged 3 commits into from
Dec 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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']>;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unnecessary space became a diff?

};

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