mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 14:27:04 +00:00
add remove function typings to pouchdb-core (#10754)
This commit is contained in:
committed by
Masahiro Wakame
parent
77bc119042
commit
d7c91b7a92
@@ -75,4 +75,31 @@ namespace PouchDBCoreTests {
|
||||
db.info({ ajax: { cache: true }}, (error, result) => {
|
||||
});
|
||||
}
|
||||
|
||||
function testRemove() {
|
||||
type MyModel = { rev: 'rev', property: 'someProperty '};
|
||||
let model: PouchDB.Core.Document<MyModel>;
|
||||
const id = 'model';
|
||||
const rev = 'rev';
|
||||
|
||||
const db = new PouchDB<MyModel>();
|
||||
|
||||
// Promise version with doc
|
||||
db.remove(model).then( (res: PouchDB.Core.Response) => {});
|
||||
|
||||
// Promise version with doc and options
|
||||
db.remove(model, {}).then( (res: PouchDB.Core.Response) => {});
|
||||
|
||||
// Promise version with docId and rev
|
||||
db.remove(id, rev).then( (res: PouchDB.Core.Response) => {});
|
||||
|
||||
// Promise version with docId and rev and options
|
||||
db.remove(id, rev, {}).then( (res: PouchDB.Core.Response) => {});
|
||||
|
||||
// Callback version with doc
|
||||
db.remove(model, {}, (res: PouchDB.Core.Response) => {});
|
||||
|
||||
// Callback version with docId and rev
|
||||
db.remove(id, rev, {}, (res: PouchDB.Core.Response) => {});
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+14
@@ -319,6 +319,20 @@ declare namespace PouchDB {
|
||||
revision?: Core.RevisionId,
|
||||
options?: Core.PutOptions): Promise<Core.Response>;
|
||||
|
||||
/** Remove a doc from the database */
|
||||
remove(doc: Core.Document<Content>,
|
||||
options: Core.Options,
|
||||
callback: Core.Callback<Core.Error, Core.Response>): void;
|
||||
remove(docId: Core.DocumentId,
|
||||
revision: Core.RevisionId,
|
||||
options: Core.Options,
|
||||
callback: Core.Callback<Core.Error, Core.Response>): void;
|
||||
remove(doc: Core.Document<Content>,
|
||||
options?: Core.Options): Promise<Core.Response>;
|
||||
remove(docId: Core.DocumentId,
|
||||
revision: Core.RevisionId,
|
||||
options?: Core.Options): Promise<Core.Response>;
|
||||
|
||||
/** Get database information */
|
||||
info(options: Core.InfoOptions | void,
|
||||
callback: Core.Callback<any, Core.DatabaseInfo>): void;
|
||||
|
||||
Reference in New Issue
Block a user