index.d.ts 902 B

1234567891011121314151617181920212223
  1. import { Store, MutationPayload } from "vuex";
  2. interface Storage {
  3. getItem: (key: string) => any;
  4. setItem: (key: string, value: any) => void;
  5. removeItem: (key: string) => void;
  6. }
  7. interface Options {
  8. key?: string;
  9. paths?: string[];
  10. reducer?: (state: any, paths: string[]) => object;
  11. subscriber?: (store: typeof Store) => (handler: (mutation: any, state: any) => void) => void;
  12. storage?: Storage;
  13. getState?: (key: string, storage: Storage) => any;
  14. setState?: (key: string, state: typeof Store, storage: Storage) => void;
  15. filter?: (mutation: MutationPayload) => boolean;
  16. arrayMerger?: (state: any, saved: any) => any;
  17. rehydrated?: (store: typeof Store) => void;
  18. fetchBeforeUse?: boolean;
  19. overwrite?: boolean;
  20. assertStorage?: (storage: Storage) => void | Error;
  21. }
  22. export default function (options?: Options): (store: any) => void;
  23. export {};