mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
PouchDB: Fix views type in post and put (#35938)
This commit is contained in:
committed by
Daniel Rosenwasser
parent
984e42db6f
commit
6cce0bd772
5
types/pouchdb-core/index.d.ts
vendored
5
types/pouchdb-core/index.d.ts
vendored
@@ -247,7 +247,10 @@ declare namespace PouchDB {
|
||||
|
||||
type PostDocument<Content extends {}> = NewDocument<Content> & {
|
||||
filters?: {[filterName: string]: string};
|
||||
views?: {[viewName: string]: string};
|
||||
views?: {[viewName: string]: {
|
||||
map: string,
|
||||
reduce?: string
|
||||
}};
|
||||
|
||||
/** You can update an existing doc using _rev */
|
||||
_rev?: RevisionId;
|
||||
|
||||
@@ -244,6 +244,26 @@ function testRemoteOptions() {
|
||||
});
|
||||
}
|
||||
|
||||
function testViews() {
|
||||
const db = new PouchDB('dbview');
|
||||
db.put({
|
||||
_id: '_design/index',
|
||||
views: {
|
||||
foo: {
|
||||
map: 'func(doc){emit(doc.foo)}',
|
||||
reduce: '_count'
|
||||
},
|
||||
bar: {
|
||||
map: 'func(doc){emit(doc.bar, doc.buzz)}',
|
||||
reduce: '_sum'
|
||||
},
|
||||
buzz: {
|
||||
map: 'func(doc){emit(doc.buzz)}'
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function heterogeneousGenericsDatabase(db: PouchDB.Database) {
|
||||
interface Cat {
|
||||
meow: string;
|
||||
|
||||
Reference in New Issue
Block a user