index.d.ts 954 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<State> {
  8. key?: string;
  9. paths?: string[];
  10. reducer?: (state: State, paths: string[]) => object;
  11. subscriber?: (store: Store<State>) => (handler: (mutation: any, state: State) => void) => void;
  12. storage?: Storage;
  13. getState?: (key: string, storage: Storage) => any;
  14. setState?: (key: string, state: any, storage: Storage) => void;
  15. filter?: (mutation: MutationPayload) => boolean;
  16. arrayMerger?: (state: any[], saved: any[]) => any;
  17. rehydrated?: (store: Store<State>) => void;
  18. fetchBeforeUse?: boolean;
  19. overwrite?: boolean;
  20. assertStorage?: (storage: Storage) => void | Error;
  21. }
  22. export default function <State>(options?: Options<State>): (store: Store<State>) => void;
  23. export {};