UNPKG

core-native

Version:

A lightweight framework based on React Native + Redux + Redux Saga, in strict TypeScript.

24 lines 1.16 kB
import { Exception } from "./Exception"; import { Module, type ModuleLifecycleListener } from "./platform/Module"; import { ModuleProxy } from "./platform/ModuleProxy"; import { type Action } from "./reducer"; import { type SagaGenerator } from "./typed-saga"; export interface TickIntervalDecoratorFlag { tickInterval?: number; } export type ActionHandler = (...args: any[]) => SagaGenerator; export type ErrorHandler = (error: Exception) => SagaGenerator; export interface ErrorListener { onError: ErrorHandler; } type ActionCreator<H> = H extends (...args: infer P) => SagaGenerator ? (...args: P) => Action<P> : never; type HandlerKeys<H> = { [K in keyof H]: H[K] extends (...args: any[]) => SagaGenerator ? K : never; }[Exclude<keyof H, keyof ModuleLifecycleListener | keyof ErrorListener>]; export type ActionCreators<H> = { readonly [K in HandlerKeys<H>]: ActionCreator<H[K]>; }; export declare function register<M extends Module<any, any>>(module: M): ModuleProxy<M>; export declare function executeAction(actionName: string, handler: ActionHandler, ...payload: any[]): SagaGenerator; export {}; //# sourceMappingURL=module.d.ts.map