import * as Rx from 'rxjs' ; interface Props { [ key ] : unknown | ( ( ... args : unknown [ ] ) => void ) ; } param collectProps export function asSyncedObservable ( collectProps ) { const boundCollectProps = ( ) => { const collectedProps = collectProps ( ) ; Object . keys ( collectedProps ) . forEach ( ( key ) => { const currentValue = collectedProps [ key ] ; if ( typeof currentValue === 'function' ) { collectedProps [ key ] = ( ... args ) => { currentValue ( ... args ) ; subject$ . next ( boundCollectProps ( ) ) ; } ; } } ) ; return collectedProps ; } ; const subject$ = new Rx . BehaviorSubject ( boundCollectProps ( ) ) ; return subject$ . asObservable ( ) ; }