UNPKG

@gongt/ts-stl-client

Version:
40 lines (39 loc) 2.69 kB
import { Options } from "react-redux"; import { Dispatch } from "redux"; import { BaseComponent, StatefulBaseComponentConstructor } from "../react/stateless-component"; import { IReduxActionConstructor } from "./action"; import { IState } from "./preload-state"; import { IVirtualStoreConstructor } from "./virtual-store"; export interface TDispatchProps { _dispatch?: Dispatch<any>; renderCounts?: number; } export declare function tDispatchMapper(disp: Dispatch<any>): TDispatchProps; export declare type WrapFunction<In, Out> = (state: In) => Out; export declare type MapperObject<State extends IState, Props> = { [K in keyof Props]?: WrapFunction<State, Props[K]>; }; export declare type MapperFunction<State extends IState, Props> = WrapFunction<State, Partial<Props>>; export declare type Mapper<State extends IState, Props> = MapperFunction<State, Props> | MapperObject<State, Props>; export declare class ReactReduxConnector<State extends IState, Props extends TDispatchProps> { protected mps: Mapper<State, Props>[]; protected advOpts: Options<any, any, any>; constructor(); addMapper(obj: Mapper<State, Props>): void; isComponentUseContext(notPure?: boolean): void; isComponentUseDOM(storeRef?: boolean): void; connect<T extends object, Class extends StatefulBaseComponentConstructor<Props, T>>(reactClass: Class): Class; } /** @deprecated */ export declare function connectToStore<State extends IState, Props extends TDispatchProps>(mapper0: WrapFunction<State, Props>): any; /** @deprecated */ export declare function connectToStore<State extends IState, Props extends TDispatchProps>(...mappers: Mapper<State, Props>[]): any; export declare type triggerFn<IData> = (this: BaseComponent<TDispatchProps>, args: IData) => void; export declare function ActionDispatcher<IData>(Act: IReduxActionConstructor<IData>): PropertyDecorator; export declare function ActionDispatcher<IData, VI>(Act: IReduxActionConstructor<IData, VI>, Sto: IVirtualStoreConstructor<VI>): PropertyDecorator; export declare type triggerMtd<IData> = (this: BaseComponent<TDispatchProps>, ...args: any[]) => IData; export declare type TypedMethodDecorator<T> = (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>; export declare type TriggerDecorator<IData> = TypedMethodDecorator<triggerMtd<IData>>; export declare const CANCEL_TRIGGER: any; export declare function ActionTrigger<IData>(Act: IReduxActionConstructor<IData>): TriggerDecorator<IData>; export declare function ActionTrigger<IData, VI>(Act: IReduxActionConstructor<IData, VI>, Sto: IVirtualStoreConstructor<VI>): TriggerDecorator<IData>;