import { Action , INIT } from '@ngrx/store' ; export function reduceActions < T > ( reducer , actions ? , returnSteps ? ) ; export function reduceActions < T > ( reducer , actions , returnSteps ) ; export function reduceActions < T > ( reducer , actions = [ ] , returnSteps = false ) { const steps = [ ] ; const finalState = [ { type : INIT } , ... actions , ] . reduce ( ( state , action ) => { const nextState = reducer ( state , action ) ; steps . push ( { ... ( < any > nextState ) , $action : action } ) ; return nextState ; } , < any > undefined ) ; return returnSteps ? steps : finalState ; }