add compact function typings to pouchdb-core (#10753)

This commit is contained in:
Keith D. Moore
2016-08-24 11:28:54 -05:00
committed by Masahiro Wakame
parent d7c91b7a92
commit 3f9b9ed351
2 changed files with 19 additions and 0 deletions

View File

@@ -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<{}>();

View File

@@ -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;