1 | import type { Dispatch, SetStateAction } from 'react';
|
2 | declare const s: unique symbol;
|
3 | type S = typeof s;
|
4 | export type Control<T> = {[s]: T};
|
5 |
|
6 | type Nullish = null | undefined;
|
7 |
|
8 | export function useControl<S>(control: Control<S> | Nullish, initial: S | (() => S)): [S, Dispatch<SetStateAction<S>>, Control<S>];
|
9 | export function useControl<S>(control: Control<S>): [S, Dispatch<SetStateAction<S>>, Control<S>];
|
10 | export function useControl<S = undefined>(control: Control<S> | Nullish): [S | undefined, Dispatch<SetStateAction<S | undefined>>, Control<S>];
|
11 |
|
12 | type State<S> = [S, Dispatch<SetStateAction<S>>];
|
13 | export function useThru<S>(control: Control<S> | Nullish, interceptor: (state: State<S>) => State<S>): Control<S>;
|
14 |
|
15 | export function isControl(maybeControl): maybeControl is Control<any>;
|