The helper which makes vuex more type-safety
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
src fix: remove a type different from the runtime behavior Feb 12, 2019
test
.gitignore
.npmignore
LICENSE Initial commit Dec 14, 2018
README.md
jest.config.js
package-lock.json
package.json
tsconfig.json

README.md

vuex-typescript-fsa

The helper function for inferring a combination of action/mutation and handler

Installation

npm install vuex-typescript-fsa

Demo

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