export type MutateStateFunc = (state: S) => S; export const applyStateChanges = (state: S, ...args: Array>): S => { return args.reduce((all, cur) => { return cur(all); }, state); };