mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-24 05:06:02 +08:00
add compact function typings to pouchdb-core (#10753)
This commit is contained in:
committed by
Masahiro Wakame
parent
d7c91b7a92
commit
3f9b9ed351
@@ -38,6 +38,16 @@ namespace PouchDBCoreTests {
|
||||
});
|
||||
}
|
||||
|
||||
function testCompact() {
|
||||
const db = new PouchDB<{}>();
|
||||
// Promise version
|
||||
db.compact().then( (res: PouchDB.Core.Response) => {});
|
||||
// Promise version with optional options
|
||||
db.compact({interval: 300}).then( (res: PouchDB.Core.Response) => {});
|
||||
// Options with a callback
|
||||
db.compact({interval: 300}, (res: PouchDB.Core.Response) => {});
|
||||
}
|
||||
|
||||
function testDestroy() {
|
||||
const db = new PouchDB<{}>();
|
||||
|
||||
|
||||
9
pouchdb-core/pouchdb-core.d.ts
vendored
9
pouchdb-core/pouchdb-core.d.ts
vendored
@@ -164,6 +164,10 @@ declare namespace PouchDB {
|
||||
interface PostOptions extends PutOptions {
|
||||
}
|
||||
|
||||
interface CompactOptions extends Core.Options {
|
||||
interval?: number;
|
||||
}
|
||||
|
||||
interface InfoOptions extends Options {
|
||||
}
|
||||
}
|
||||
@@ -264,6 +268,11 @@ declare namespace PouchDB {
|
||||
allDocs(options?: Core.AllDocsOptions):
|
||||
Promise<Core.AllDocsResponse<Content>>;
|
||||
|
||||
/** Compact the database */
|
||||
compact(options?: Core.CompactOptions): Promise<Core.Response>;
|
||||
compact(options: Core.CompactOptions,
|
||||
callback: Core.Callback<Core.Error, Core.Response>): void;
|
||||
|
||||
/** Destroy the database */
|
||||
destroy(options: Core.DestroyOptions | void,
|
||||
callback: Core.AnyCallback): void;
|
||||
|
||||
Reference in New Issue
Block a user