UNPKG

core-native

Version:

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

26 lines (25 loc) 1.09 kB
import { SagaIterator } from "redux-saga"; import { Exception } from "./Exception"; import { Module, ModuleLifecycleListener } from "./platform/Module"; import { ModuleProxy } from "./platform/ModuleProxy"; import { Action } from "./reducer"; export interface LifecycleDecoratorFlag { isLifecycle?: boolean; } export interface TickIntervalDecoratorFlag { tickInterval?: number; } export declare type ActionHandler = (...args: any[]) => SagaIterator; export declare type ErrorHandler = (error: Exception) => SagaIterator; export interface ErrorListener { onError: ErrorHandler; } declare type ActionCreator<H> = H extends (...args: infer P) => SagaIterator ? ((...args: P) => Action<P>) : never; declare type HandlerKeys<H> = { [K in keyof H]: H[K] extends (...args: any[]) => SagaIterator ? K : never; }[Exclude<keyof H, keyof ModuleLifecycleListener | keyof ErrorListener>]; export declare type ActionCreators<H> = { readonly [K in HandlerKeys<H>]: ActionCreator<H[K]>; }; export declare function register<M extends Module<any>>(module: M): ModuleProxy<M>; export {};