Skip to content

Commit

Permalink
Allow single decorators as well
Browse files Browse the repository at this point in the history
  • Loading branch information
kasperpeulen committed Nov 22, 2023
1 parent 6cfa85d commit 5691c7f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions story.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,9 @@ export type BaseAnnotations<TRenderer extends Renderer = Renderer, TArgs = Args>
* Decorators defined in Meta will be applied to every story variation.
* @see [Decorators](https://storybook.js.org/docs/addons/introduction/#1-decorators)
*/
decorators?: DecoratorFunction<TRenderer, Simplify<TArgs>>[];
decorators?:
| DecoratorFunction<TRenderer, Simplify<TArgs>>[]
| DecoratorFunction<TRenderer, Simplify<TArgs>>;

/**
* Custom metadata for a story.
Expand Down Expand Up @@ -397,8 +399,8 @@ export type StoryAnnotationsOrFn<TRenderer extends Renderer = Renderer, TArgs =

export type ArgsFromMeta<TRenderer extends Renderer, Meta> = Meta extends {
render?: ArgsStoryFn<TRenderer, infer RArgs>;
loaders?: (infer Loaders)[];
decorators?: (infer Decorators)[];
loaders?: (infer Loaders)[] | infer Loaders;
decorators?: (infer Decorators)[] | infer Decorators;
}
? Simplify<
RemoveIndexSignature<
Expand Down

0 comments on commit 5691c7f

Please sign in to comment.