forked from dump247/storybook-state
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
27 lines (23 loc) · 900 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
import { Renderable, RenderFunction } from '@storybook/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 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