import produce , { Draft } from 'immer' ; import RootActions from 'actions' ; export default function createReducer < T , A extends RootActions > ( name ) { return ( recipe ) => { const reducer = produce ( recipe ) ; return Object . defineProperty ( reducer , 'name' , { value : `${ name }Reducer` , configurable : true , } ) as typeof reducer ; } ; }