import { ActionTree , MutationTree } from "vuex" ; import { ActionCreator , PayloadType } from "./action-creator" ; import { Action , Mutation } from "./types/vuex" ; import { FSA } from "./types/fsa" ; /**
 * Create action handler with type annotation
 */ export function action < S , R , A extends ActionCreator < any > > ( actionCreator , action ) { return { [ actionCreator . type ] : action } ; } /**
 * Create mutation handler with type annotation
 */ export function mutation < S , A extends ActionCreator < any > > ( actionCreator , mutation ) { return { [ actionCreator . type ] : mutation } ; } /**
 * Combine action handlers as a ActionTree
 */ export function combineAction < S , R > ( ... actions ) { return actions . reduce ( ( res , v ) => Object . assign ( res , v ) , { } ) ; } /**
 * Combine mutation handlers as a ActionTree
 */ export function combineMutation < S > ( ... mutations ) { return mutations . reduce ( ( res , v ) => Object . assign ( res , v ) , { } ) ; }