1 | import * as React from 'react';
|
2 |
|
3 | type GetFn<T> = (state: T) => React.ReactNode;
|
4 | type PrevState<T> = (prevState: T) => T;
|
5 |
|
6 |
|
7 | interface State<T> {
|
8 | Ctx: (
|
9 | fn: GetFn<S> | {children: (state: T) => React.ReactNode}
|
10 | ) => React.ReactNode;
|
11 | Put: (nextState: T | PrevState<T>) => void;
|
12 | Val: <S = any>(
|
13 | selector: (state: T) => S
|
14 | ) => (fn: GetFn<S>) => React.ReactNode;
|
15 | Auto: <S = any>(
|
16 | selector: (state: T) => S
|
17 | ) => (
|
18 | fn: GetFn<S> | {children: (state: S) => React.ReactNode}
|
19 | ) => React.ReactNode;
|
20 | }
|
21 |
|
22 | export function init<T = any>(initial: T = {}): State<T>;
|