DefinitelyTyped/types/pouch-redux-middleware/index.d.ts
Max Battcher 3b6b92d45e Revert PouchDB module changes from #18519 (#20305)
Per the README, and with research prompted by #19691, the shape of PouchDB export should reflect what is currently the node package's package.json main export shape (not jsnext:main).
2017-10-05 11:23:53 -07:00

34 lines
1.1 KiB
TypeScript

// Type definitions for pouch-redux-middleware 0.5
// Project: https://github.com/pgte/pouch-redux-middleware
// Definitions by: Adam Charron <https://github.com/charrondev>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import { Dispatch, Action, Middleware } from 'redux';
import * as PouchDB from 'pouchdb';
export interface Document {
_id: any;
[field: string]: any;
}
export interface Path {
path: string;
db: PouchDB.Database<any>;
scheduleRemove?(doc: Document): void;
scheduleInset?(doc: Document): void;
propagateDelete?(doc: Document, dispatch: Dispatch<any>): void;
propagateInsert?(doc: Document, dispatch: Dispatch<any>): void;
propagateUpdate?(doc: Document, dispatch: Dispatch<any>): void;
handleResponse?(err: Error, data: any, errorCallback: (err: Error) => void): void;
queue?(...args: any[]): any;
docs?: any;
actions: {
remove(doc: Document): Action;
update(doc: Document): Action;
insert(doc: Document): Action;
};
}
export default function PouchMiddlewareFactory(paths?: Path[] | Path): Middleware;