interface Glue { [index:string]: any; } interface DestructResult { reducers: {[index:string]: any}, actions: {[index:string]: any}, referToState: (model: any) => any, hasModel: (model: any) => boolean, } interface Dispatch { (p: any): any; } interface GetState { (p?: any): any; } interface DestructParams { dispatch: Dispatch; getState: GetState; [index: string]: any; } interface DestructReturn { (structure: Glue): DestructResult; } interface Destruct { (p: DestructParams): DestructReturn; } type HandleFunc = (data: D, state: S) => S; type fnc = (data?: D) => D; export type GluerReturn = { readonly [P in keyof S]: S[P]; } & fnc & { actionType: string }; export function gluer(onlyOne?: HandleFunc | S) : GluerReturn; export function gluer(fn: HandleFunc, initialState: S) : GluerReturn; export const destruct: Destruct;