Files
DefinitelyTyped/types/pouch-redux-middleware/pouch-redux-middleware-tests.ts
Hadrien de Cuzey b629f5171e [pouchdb] Update types definitions for the latest version of pouchdb (#18519)
Add an optional extended description…
2017-07-31 13:47:32 -07:00

23 lines
695 B
TypeScript

import * as redux from 'redux';
import makePouchMiddleware, { Document, Path } from 'pouch-redux-middleware';
import PouchDB from 'pouchdb';
const types = {
DELETE_TODO: 'delete-todo',
INSERT_TODO: 'insert-todo',
UPDATE_TODO: 'update-todo'
};
const path: Path = {
path: "/test",
db: new PouchDB('test'),
actions: {
remove: doc => ({ type: types.DELETE_TODO, id: doc._id }),
insert: doc => ({ type: types.INSERT_TODO, todo: doc }),
update: doc => ({ type: types.UPDATE_TODO, todo: doc }),
}
};
const middleware: redux.Middleware = makePouchMiddleware(path);
const otherMiddleware: redux.Middleware = makePouchMiddleware([path, path, path]);