@winglet/json
Version:
TypeScript library for safe and efficient JSON data manipulation with RFC 6901 (JSON Pointer) and RFC 6902 (JSON Patch) compliance, featuring prototype pollution protection and immutable operations
17 lines (13 loc) • 441 B
TypeScript
export interface Fn<Params extends Array<any> = [], Return = void> {
(...props: Params): Return;
}
export interface AsyncFn<Params extends Array<any> = [], Return = void> {
(...props: Params): Promise<Return>;
}
export type SetStateFn<S = unknown> = (
value: S | ((prevState: S) => S),
) => void;
export type Parameter<
F extends Fn<[any]> | SetStateFn<any> | undefined,
I extends number = 0,
> = Parameters<NonNullable<F>>[I];