import { Middleware, Store, UnknownAction } from 'redux'; import { Readable } from 'svelte/store'; import { SagaGenerator } from 'typed-redux-saga'; export type StoreAction = { type: string; payload: PL; }; export type GenericAction = StoreAction; export type PayloadModifier = (...args: ARGS) => PL; export type StoreActionCreator = { (...args: ARGS): StoreAction; type: string; toString: () => string; }; export type SuccessResponse = { request: PL; response: R; }; export type ErrorResponse = { request: PL; error: Error; }; export type StoreAsyncAction = { type: string; asyncActionType: string; payload: PL; promise: Promise; success: StoreActionCreator<[R], SuccessResponse>; failure: StoreActionCreator<[Error], ErrorResponse>; }; export type StoreAsyncActionCreator = { (...args: ARGS): StoreAsyncAction; type: string; asyncActionType: string; success: StoreActionCreator<[R], SuccessResponse>; failure: StoreActionCreator<[Error], ErrorResponse>; toString: () => string; }; export type MiddlewareFunction = (action: GenericAction, api: { dispatch: ReduxStore["dispatch"]; getState: ReduxStore["getState"]; }) => GenericAction | Promise | void; export type StoreMiddleware = Middleware; type StateDomain = string; export type StoreStateMap = Record; export type StoreReducerFunction = (state: any, action: any) => TState; export type ReducersMap = Record; export type StoreOptions = { /** * Reactive selector emission frequency in frames per second. * Defaults to 64 FPS and accepts finite values in the inclusive 1..256 range. */ throttledSelectorFrequency?: number; /** * Enables the built-in redux-saga monitor for Store-owned saga middleware. * Defaults to false, leaving saga monitoring disabled. */ sagaMonitor?: boolean; /** * Enables diagnostic selector flush tracing. * Defaults to false, leaving selector tracing silent. */ traceSelectors?: boolean; }; export type NormalizedStoreOptions = { throttledSelectorFrequency: number; sagaMonitor: boolean; traceSelectors: boolean; }; export type StoreReducerState = Reducer extends StoreReducerFunction ? State : never; export type StoreStateFromStateMap = { [Domain in keyof TStateMap]: TStateMap[Domain]; }; export type StoreStateFromReducers = { [Domain in keyof Reducers]: StoreReducerState; }; export type StoreState = TStore extends { readonly state: infer State; } ? State : TStore extends { getReadableState(): Readable; } ? State : TStore extends { getReducers(): infer Reducers; } ? Reducers extends ReducersMap ? StoreStateFromReducers : Record : Record; /** * StoreInstanceState is a readable alias for the selector state shape of a concrete Store instance. */ export type StoreInstanceState = StoreState; export type StoreReadableStateSource = { getReadableState(): Readable; }; export type PreloadedStoreState = Partial; type ReduxStore = Store; /** * Converts an args tuple so that each element can be either a plain value or a Readable. * Used by selectors to accept reactive arguments in Svelte components. */ export type ReadableArgs = { [K in keyof ARGS]: ARGS[K] | Readable; }; export type StoreSelectorCallback = (state: TState, ...args: ARGS) => R; export type StoreSelectorReadable = (...args: ReadableArgs) => Readable; export type StoreSelectorSelect = StoreSelectorCallback; export type StoreSelectorEffect = (...args: ARGS) => SagaGenerator; type StoreSelectorWithStore = (store: StoreReadableStateSource | ReduxStore) => StoreSelectorReadable; export type StoreSelector = StoreSelectorReadable & { withStore: StoreSelectorWithStore; select: StoreSelectorSelect; effect: StoreSelectorEffect; }; export type CreateSelector = , ARGS extends any[] = [], R = unknown>(store: TStore, selectorFunc: StoreSelectorCallback>) => StoreSelector>; export {}; //# sourceMappingURL=types.d.ts.map