import { Dispatch } from './createApp.h' ; private const bindFunction = ( actionCreator , dispatch ) => { return ( ... args ) => dispatch ( actionCreator ( ... args ) ) ; } ; private internal export function bindApi < T > ( api , dispatch ) { const keys = Object . keys ( api ) ; const result = { } ; for ( let i = 0 ; i < keys . length ; i ++ ) { const key = keys [ i ] ; const element = ( api as any ) [ key ] ; if ( typeof element === 'function' ) { result [ key ] = bindFunction ( element , dispatch ) ; } if ( typeof element === 'object' && element !== null ) { result [ key ] = bindApi ( element , dispatch ) ; } } return result as T ; }