CoolFace
Apppublic

AK-21/Graphite-Industrial-Intelligence

sourceHugging Faceupdated 3mo agoView on Hugging Face
0likes
context.d.ts26 linesDownload Raw Back to zustand
1import ReactExports from 'react';2import type { ReactNode } from 'react';3import type { StoreApi } from 'zustand';4type UseContextStore<S extends StoreApi<unknown>> = {5    (): ExtractState<S>;6    <U>(selector: (state: ExtractState<S>) => U, equalityFn?: (a: U, b: U) => boolean): U;7};8type ExtractState<S> = S extends {9    getState: () => infer T;10} ? T : never;11type WithoutCallSignature<T> = {12    [K in keyof T]: T[K];13};14/**15 * @deprecated Use `createStore` and `useStore` for context usage16 */17declare function createContext<S extends StoreApi<unknown>>(): {18    Provider: ({ createStore, children, }: {19        createStore: () => S;20        children: ReactNode;21    }) => ReactExports.FunctionComponentElement<ReactExports.ProviderProps<S | undefined>>;22    useStore: UseContextStore<S>;23    useStoreApi: () => WithoutCallSignature<S>;24};25export default createContext;26