use-merge-state
Version:
A useState variant hook that merges updates.
10 lines (9 loc) • 547 B
TypeScript
export declare type PlainObject<T = unknown> = Record<string, T>;
export declare type PlainFunction<P = any, R = any> = (...args: P[]) => R;
export declare type Unpack<T> = T extends (infer U)[] ? U : T;
export declare type Except<T extends PlainObject, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
export declare type Spread<A extends PlainObject, B extends PlainObject> = B & Except<A, Extract<keyof A, keyof B>>;
export interface DispatchWithOptions<A, O = undefined> {
(value: A): void;
(value: A, options?: O): void;
}