diff --git a/packages/react/src/hooks/useStore.ts b/packages/react/src/hooks/useStore.ts index 9f7f8255..a80217a2 100644 --- a/packages/react/src/hooks/useStore.ts +++ b/packages/react/src/hooks/useStore.ts @@ -1,6 +1,5 @@ import { useContext, useMemo } from 'react'; import { useStoreWithEqualityFn as useZustandStore } from 'zustand/traditional'; -import type { StoreApi } from 'zustand'; import { errorMessages } from '@xyflow/system'; import StoreContext from '../contexts/RFStoreContext'; @@ -8,8 +7,6 @@ import type { ReactFlowState } from '../types'; const zustandErrorMessage = errorMessages['error001'](); -type ExtractState = StoreApi extends { getState: () => infer T } ? T : never; - /** * Hook for accessing the internal store. Should only be used in rare cases. * @@ -18,7 +15,8 @@ type ExtractState = StoreApi extends { getState: () => infer T } * @param equalityFn * @returns The selected state slice */ -function useStore( + +function useStore( selector: (state: ReactFlowState) => StateSlice, equalityFn?: (a: StateSlice, b: StateSlice) => boolean ) { diff --git a/packages/react/src/types/store.ts b/packages/react/src/types/store.ts index 27482dba..38e3fbe9 100644 --- a/packages/react/src/types/store.ts +++ b/packages/react/src/types/store.ts @@ -45,7 +45,7 @@ import type { OnBeforeDelete, } from '.'; -export type ReactFlowStore = { +export type ReactFlowStore = { rfId: string; width: number; height: number;