import { Reducer } from "redux" ; import { Action } from "../model/model" ; export default function createReducer < S > ( initialState , handlers ) { const r = ( state = initialState , action ) : S => { if ( handlers . hasOwnProperty ( action . type ) ) { return handlers [ action . type ] ( state , action ) ; } else { return state ; } } ; return r as Reducer < S > ; }