UNPKG

state-decorator

Version:
58 lines (57 loc) 3.97 kB
import type { StoreAction } from './types'; import { ConflictPolicy } from './types'; import type { AdvancedSynchAction, AsynchActionPromiseGet, StateDecoratorAction, StateDecoratorActions, StateDecoratorOptions, AsynchActionPromise, SynchAction, LoadingMap, LoadingProps, LoadingMapParallelActions, AsynchAction } from './v5_types'; import { setGlobalConfig } from './impl'; export type { AdvancedSynchAction, AsynchActionPromiseGet, StateDecoratorAction, StateDecoratorActions, StateDecoratorOptions, AsynchActionPromise, SynchAction, LoadingMap, LoadingMapParallelActions, LoadingProps, ConflictPolicy, setGlobalConfig, }; /** * Type guard function to test if an action is a asynchronous action. */ export declare function isAsyncAction<S, F extends (...args: any[]) => any, A, P>(action: StateDecoratorAction<S, F, A, P>): action is AsynchAction<S, F, A, P>; /** * Type guard function to test if an action is a asynchronous action. */ export declare function isAsyncPromiseGetAction<S, F extends (...args: any[]) => any, A, P>(action: StateDecoratorAction<S, F, A, P>): action is AsynchActionPromiseGet<S, F, A, P>; /** * Type guard function to test if an action is a synchronous action. */ export declare function isSyncAction<S, F extends (...args: any[]) => any, A, P>(action: StateDecoratorAction<S, F, A, P>): action is SynchAction<S, F, P>; /** * Type guard function to test if an action is a synchronous action. */ export declare function isAdvancedSyncAction<S, F extends (...args: any[]) => any, A, P>(action: StateDecoratorAction<S, F, A, P>): action is AdvancedSynchAction<S, F, A, P>; /** * Utility to test an asynchronous action. * @param action The action to test * @param test The test function that takes the discrimined action type and cam return a promise */ export declare function testAsyncAction<S, F extends (...args: any[]) => any, A, P>(action: StateDecoratorAction<S, F, A, P>, test: (action: AsynchActionPromise<S, F, A, P>) => any | Promise<any>): any; /** * Utility to test an synchronous action. * @param action The action to test * @param test The test function that takes the discrimined action type and cam return a promise */ export declare function testSyncAction<S, F extends (...args: any[]) => any, A, P>(action: StateDecoratorAction<S, F, A, P>, test: (action: SynchAction<S, F, P>) => any | Promise<any>): any; /** * Utility to test an advanced synchronous action. * @param action The action to test * @param test The test function that takes the discrimined action type and cam return a promise */ export declare function testAdvancedSyncAction<S, F extends (...args: any[]) => any, A, P>(action: StateDecoratorAction<S, F, A, P>, test: (action: AdvancedSynchAction<S, F, A, P>) => any | Promise<any>): any; /** * Utility to test a V6 synchronous action using v5 test. * @param action The action to test * @param test The test function that takes the discrimined action type and cam return a promise */ export declare function testV6SyncAction<S, F extends (...args: any[]) => any, A, P>(action: StoreAction<S, F, A, P>, test: (action: SynchAction<S, F, P>) => any | Promise<any>): Promise<void>; /** * Utility to test a V6 synchronous action using v5 test. * @param actionIn The action to test * @param test The test function that takes the discrimined action type and cam return a promise */ export declare function testV6AdvancedSyncAction<S, F extends (...args: any[]) => any, A, P>(actionIn: StoreAction<S, F, A, P>, test: (action: AdvancedSynchAction<S, F, A, P>) => any | Promise<any>): Promise<void>; /** * Utility to test a V6 synchronous action using v5 test. * @param actionIn The action to test * @param test The test function that takes the discrimined action type and cam return a promise */ export declare function testV6AsyncAction<S, F extends (...args: any[]) => any, A, P>(actionIn: StoreAction<S, F, A, P>, test: (action: AsynchAction<S, F, A, P>) => any | Promise<any>): any;