From bc9d5e128b66bd8087fb6aae7bbf2c93dc0c0ac9 Mon Sep 17 00:00:00 2001 From: Joscha Feth Date: Mon, 10 Apr 2017 15:59:11 +1000 Subject: [PATCH 1/3] Add typescript definitions for getStorybook() `2.35.3` add `getStorybook()` in 86d5819a7b8843a1331c33eb7bef17bae0d98006, but Typescript definitions were not updated. --- config/storybook.d.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/config/storybook.d.ts b/config/storybook.d.ts index ba6252ae7f15..618326eda088 100644 --- a/config/storybook.d.ts +++ b/config/storybook.d.ts @@ -1,7 +1,9 @@ declare var module: any; // dangerous +type RenderFunction = Function; + interface StoryDecorator { - (story: Function, context: { kind: string, story: string }): Object | null; + (story: RenderFunction, context: { kind: string, story: string }): Object; } interface Story { @@ -13,3 +15,15 @@ export function addDecorator(decorator: StoryDecorator): void; export function linkTo(name: string, ...params: any[]): void; export function storiesOf(name: string, module: any): Story; export function action(name: string, ...params: any[]): any; + +type StoryObject = { + name: string, + render: RenderFunction, +}; + +type StoryBucket = { + kind: string, + stories: StoryObject[], +}; + +export function getStorybook(): StoryBucket[]; From 0e9d7dea4eb1d8d699a2021f775a65852ed2910e Mon Sep 17 00:00:00 2001 From: Joscha Feth Date: Mon, 10 Apr 2017 17:54:18 +1000 Subject: [PATCH 2/3] Also add `configure` --- config/storybook.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/config/storybook.d.ts b/config/storybook.d.ts index 618326eda088..f454f3e56b10 100644 --- a/config/storybook.d.ts +++ b/config/storybook.d.ts @@ -12,6 +12,7 @@ interface Story { } export function addDecorator(decorator: StoryDecorator): void; +export function configure(fn: Function, module: any): void; export function linkTo(name: string, ...params: any[]): void; export function storiesOf(name: string, module: any): Story; export function action(name: string, ...params: any[]): any; From dd49bda93ea033dccec7e84b4c9361c553300388 Mon Sep 17 00:00:00 2001 From: Joscha Feth Date: Thu, 13 Apr 2017 10:51:46 +1000 Subject: [PATCH 3/3] Update storybook.d.ts Incorporate https://github.com/storybooks/react-storybook/pull/680 --- config/storybook.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/storybook.d.ts b/config/storybook.d.ts index f454f3e56b10..a7c34ab3c8b6 100644 --- a/config/storybook.d.ts +++ b/config/storybook.d.ts @@ -3,7 +3,7 @@ declare var module: any; // dangerous type RenderFunction = Function; interface StoryDecorator { - (story: RenderFunction, context: { kind: string, story: string }): Object; + (story: RenderFunction, context: { kind: string, story: string }): Object | null; } interface Story {