Vuex Extended Types
Type helper based in Object-Style to ensure type safety in Vuex.
Allow to use type safety in Vuex with the Object-style commit and dispatch.
A more complex sample implementing modules and link to explained talk.
Installation
# npm $ npm install vuex-extended-types # yarn $ yarn add vuex-extended-types
Example
;; /** * Declare module types */ /** Implement the module */; ; ; /** Define an object-style with mutations and export it */; ; /** Define an object-style with actions and export it */; /** Create a store as same as the ordinary way */; /** Export a store as default with extended types of Vuex Store to use typed Getters */; /** Export an object-style type to use it in app */; /** Use dispatch/commit methods with exported object-style type */store.dispatch counterHelpers.actions!.incrementAsync; store.commitcounterHelpers.mutations!.increment;store.commitcounterHelpers.mutations!.decrement; // ! <- You can use the Non-Null Assertion Operator···computed:
License
MIT