UNPKG

879 BTypeScriptView Raw
1declare global {
2 interface SymbolConstructor {
3 readonly observable: symbol;
4 }
5}
6interface Args {
7 [name: string]: any;
8}
9interface Globals {
10 [name: string]: any;
11}
12type Renderer = {
13 /** What is the type of the `component` annotation in this renderer? */
14 component: unknown;
15 /** What does the story function return in this renderer? */
16 storyResult: unknown;
17 /** What type of element does this renderer render to? */
18 canvasElement: unknown;
19 T?: unknown;
20};
21interface StoryContextUpdate<TArgs = Args> {
22 args?: TArgs;
23 globals?: Globals;
24 [key: string]: any;
25}
26type PartialStoryFn<TRenderer extends Renderer = Renderer, TArgs = Args> = (update?: StoryContextUpdate<Partial<TArgs>>) => TRenderer['storyResult'];
27
28declare const withActions: <T extends Renderer>(storyFn: PartialStoryFn<T>) => T['storyResult'];
29
30export { withActions };