UNPKG

@mrii/react-table-builder

Version:
24 lines (23 loc) 971 B
/// <reference types="react" /> import type { StoreApi, StateCreator } from 'zustand'; type ExtractState<S> = S extends { getState: () => infer T; } ? T : never; type WithReact<S extends StoreApi<unknown>> = S & { getServerState?: () => ExtractState<S>; }; export type StateSelector<S extends WithReact<StoreApi<unknown>>> = { (): ExtractState<S>; <U>(selector: (state: ExtractState<S>) => U, equals?: (a: U, b: U) => boolean): U; }; export type ProviderProps<TState extends object, TActions extends object> = { name?: string; initialState: TState; actions: StateCreator<TState & TActions, [ ['zustand/devtools', never], ['zustand/immer', never] ], [ ], TActions>; }; export declare const createZustandContext: <TState extends object, TActions extends object>() => readonly [import("react").FC<import("react").PropsWithChildren<ProviderProps<TState, TActions>>>, StateSelector<StoreApi<TState & TActions>>]; export {};