UNPKG

@bye_past/vuex-helpers

Version:

vuex-helpers is a utility library for Vue 3 and Vuex 4, simplifying the use of Vuex's mapper functions. This library provides a set of hooks for Vuex, making it more concise to use Vuex in Vue components.

13 lines (12 loc) 914 B
import { computed } from 'vue'; type ComputedRefProps<T> = { [K in keyof T]: ReturnType<typeof computed>; }; type MappedFunctions<T> = { [K in keyof T]: (...args: any[]) => any; }; export declare const useState: <M extends Record<string, any>, K extends keyof M>(moduleName: string | string[], mapper?: K[] | undefined) => ComputedRefProps<Pick<M, K | keyof M>>; export declare const useGetters: <M extends Record<string, any>, K extends keyof M>(moduleName: string | string[], mapper?: K[] | undefined) => ComputedRefProps<Pick<M, K | keyof M>>; export declare const useMutations: <M extends Record<string, (...args: any[]) => any>>(moduleName: string | string[], mapper?: (keyof M)[] | undefined) => MappedFunctions<M>; export declare const useActions: <M extends Record<string, (...args: any[]) => any>>(moduleName: string | string[], mapper?: (keyof M)[] | undefined) => MappedFunctions<M>; export {};