vuex-typescript-fsa
v0.4.1
Published
The helper which makes vuex more type-safety
Downloads
861
Readme
vuex-typescript-fsa
The helper function for inferring a combination of action/mutation and handler
This project is under development. Some features have bugs and some APIs might be changed near future.
Installation
npm install vuex-typescript-fsa
Demo
Usage
const Increment = actionCreator<number>("Increment");
const store = new Store<{ count: number }>({
state: {
count: 0
},
actions: combineAction(
action(Increment, function(context, action) {
context.commit(action);
})
),
mutations: combineMutation(
mutation(Increment, function(state, action) {
state.count = action.payload;
})
)
});
store.dispatch(Increment(10));
License
MIT