forked from dump247/storybook-state
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
31 lines (25 loc) · 993 Bytes
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import * as React from 'react';
export type Store<T> = {
/**
* @description
* Object that contains the current state.
*/
state: T;
/**
* @description
* Set the given state keys. The state parameter is an object with the keys and values to set.
* This only sets/overwrites the specific keys provided.
*/
set(nextState: Partial<T>): void;
/**
* @description
* Reset the store to the initial state.
*/
reset(): void;
};
export type Renderable = React.ComponentType | JSX.Element;
export type RenderFunction = () => Renderable | Renderable[];
export type LegacyStorybookStateCallback<T> = (store: Store<T>) => Renderable | Renderable[];
export function withState<T extends {}>(state: T, callback: LegacyStorybookStateCallback<T>): any // RenderFunction;
export type StorybookStateCallback<T> = (context: {store: Store<T>}) => Renderable | Renderable[];
export function withState<T extends {}>(state: T): (callback: StorybookStateCallback<T>) => any