From 31ddd01c073107a2970f5af7f3c19a97a99b7b20 Mon Sep 17 00:00:00 2001 From: Dan Dean Date: Mon, 5 Nov 2018 12:11:22 -0800 Subject: [PATCH] Fix the signaure of @storybook/react .add() method The `add` method takes an optional 3rd `paramters` option which is used to configure globally installed addons for the current story. --- types/storybook__react/index.d.ts | 3 ++- types/storybook__react/storybook__react-tests.tsx | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/types/storybook__react/index.d.ts b/types/storybook__react/index.d.ts index 3aa3445f61..91b686ffcf 100644 --- a/types/storybook__react/index.d.ts +++ b/types/storybook__react/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/storybooks/storybook // Definitions by: Joscha Feth // Anton Izmailov +// Dan Dean // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -16,7 +17,7 @@ export type StoryDecorator = (story: RenderFunction, context: { kind: string, st export interface Story { readonly kind: string; - add(storyName: string, callback: RenderFunction): this; + add(storyName: string, callback: RenderFunction, parameters?: { [key: string]: any }): this; addDecorator(decorator: StoryDecorator): this; } diff --git a/types/storybook__react/storybook__react-tests.tsx b/types/storybook__react/storybook__react-tests.tsx index 12edecb219..ba19df798e 100644 --- a/types/storybook__react/storybook__react-tests.tsx +++ b/types/storybook__react/storybook__react-tests.tsx @@ -30,6 +30,7 @@ storiesOf('withAnyAddon', module) .addWithSideEffect('more', () =>
) .add('another story', () =>
) .add('to Storybook as Array', () => [
,
]) + .add('and a story with additional parameters', () =>
, { parameter: 'foo' }) .addWithSideEffect('even more', () =>
); // configure