import Vuex , { CommitOptions , DispatchOptions , Store } from 'vuex' ; type StoreDefaults = { mutations : any ; getters : any ; state : any ; actions : any ; } ; type GenerateTypedStoreReturn < T extends StoreDefaults > = Omit < Store < T [ 'state' ] > , 'getters' | 'commit' | 'dispatch' > & { commit < K extends keyof T [ 'mutations' ] , P extends Parameters < T [ 'mutations' ] [ K ] > [ 1 ] > ( key , payload ? , options ? ) : ReturnType < T [ 'mutations' ] [ K ] > ; } & { dispatch < K extends keyof T [ 'actions' ] > ( key , payload ? , options ? ) : ReturnType < T [ 'actions' ] [ K ] > ; } & { getters : { [ K in keyof T [ 'getters' ] ] : ReturnType < T [ 'getters' ] [ K ] > ; } ; } ; const createTestStore = < T extends StoreDefaults > ( options ) : GenerateTypedStoreReturn < T > => new Vuex . Store ( { ... options , } ) as unknown as GenerateTypedStoreReturn < T > ; export { createTestStore } ;