Skip to content

Commit ec2f10c

Browse files
committed
fix: type for @storybook/react@v4.0.0-alpha
1 parent 5bbb939 commit ec2f10c

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

examples/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
},
1111
"include": [
1212
"stories",
13+
"types",
1314
"../src"
1415
],
1516
"exclude": [

examples/types/declarations.d.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Type definitions for @storybook/react 4.0.0-alpha
2+
/// <reference types="webpack-env" />
3+
4+
import * as React from 'react'
5+
6+
import { Options } from '@storybook/addon-info'
7+
8+
declare module '@storybook/react' {
9+
export interface Story {
10+
readonly kind: string
11+
add(
12+
storyName: string,
13+
callback: RenderFunction,
14+
options?: { info: Options & { text?: string | React.ReactNode } }
15+
): this
16+
addDecorator(decorator: StoryDecorator): this
17+
}
18+
19+
export function addDecorator(decorator: StoryDecorator): void
20+
export function configure(fn: () => void, module: NodeModule): void
21+
export function setAddon(addon: object): void
22+
export function storiesOf(name: string, module: NodeModule): Story
23+
export function storiesOf<T>(name: string, module: NodeModule): Story & T
24+
export function forceReRender(): void
25+
26+
export interface StoryObject {
27+
name: string
28+
render: RenderFunction
29+
}
30+
31+
export interface StoryBucket {
32+
kind: string
33+
stories: StoryObject[]
34+
}
35+
36+
export function getStorybook(): StoryBucket[]
37+
}

0 commit comments

Comments
 (0)