import { SetState } from 'zustand'; import StatusEnum from '../constants/StatusEnum'; export type { EntityStateType } from '../models/entity-state'; export type Comparer = (a: TModel, b: TModel) => number; export type EntityId = number | string; export type Action = void> = (...args: TArguments) => TReturn; export type SetAction = void> = (set: SetState) => Action; export type Selector = TArguments extends undefined[] ? (appState: TAppState) => TReturnType : (...args: TArguments) => (appState: TAppState) => TReturnType; export type SliceSelectors> = Record>> = { selectSliceState: Selector selectActions: (state: TAppState) => TActionsState }; export type MetaSliceSelectors = { selectLastModified: Selector; }; export type AsyncMetaSliceSelectors = MetaSliceSelectors & { selectLastHydrated: Selector; selectError: Selector; selectStatus: Selector; }; export type SliceStateActions = { reset: Action; }; export type SliceSetActions = { reset: SetAction; }; export type AsyncSliceStateActions = SliceStateActions & { setError: Action<[TError]>; setStatus: Action<[StatusEnum]>; }; export type AsyncSliceSetActions = SliceSetActions & { setError: SetAction; setStatus: SetAction; }; export type SelectIdMethod = (model: TEntity) => EntityId;