import { ActionType, composeTypes, createAction } from 'iron-redux'; const prefix = 'home'; enum BasicTypes { changeName } enum FetchTypes {} const Types = composeTypes({ prefix, BasicTypes, FetchTypes }); export const actions = { changeName: createAction(Types.changeName)() }; export class InitialState { public name = '1'; } /** * reducer */ export function reducer(state = new InitialState(), action: ActionType): InitialState { switch (action.type) { case Types.changeName: { return { ...state, name: '2' }; } default: { return state; } } }