diff --git a/types/pouchdb-mapreduce/index.d.ts b/types/pouchdb-mapreduce/index.d.ts index 7b398d730b..b9a05ff7d6 100644 --- a/types/pouchdb-mapreduce/index.d.ts +++ b/types/pouchdb-mapreduce/index.d.ts @@ -10,9 +10,9 @@ /* tslint:disable:no-single-declare-module */ declare namespace PouchDB { - interface Filter { - map(doc: any): void; - reduce?(key: string, value: any): any; + interface Filter { + map(doc: Content): void; + reduce?(key: string, value: Content): Reduction; } namespace Query { @@ -94,17 +94,32 @@ declare namespace PouchDB { * Invoke a map/reduce function, which allows you to perform more complex queries * on PouchDB than what you get with allDocs(). */ - query(fun: string | Filter | ((doc: any) => void), opts: Query.Options, callback: (err: Core.Error, res: Query.Response) => void): void; + query(fun: string | ((doc: Content & Model) => void), opts: Query.Options, callback: (err: Core.Error, res: Query.Response) => void): void; /** * Invoke a map/reduce function, which allows you to perform more complex queries * on PouchDB than what you get with allDocs(). */ - query(fun: string | Filter | ((doc: any) => void), callback: (err: Core.Error, res: Query.Response) => void): void; + query(fun: Filter, opts: Query.Options, callback: (err: Core.Error, res: Query.Response) => void): void; /** * Invoke a map/reduce function, which allows you to perform more complex queries * on PouchDB than what you get with allDocs(). */ - query(fun: string | Filter | ((doc: any) => void), opts?: Query.Options): Promise>; + query(fun: string | ((doc: Content & Model) => void), callback: (err: Core.Error, res: Query.Response) => void): void; + /** + * Invoke a map/reduce function, which allows you to perform more complex queries + * on PouchDB than what you get with allDocs(). + */ + query(fun: Filter, callback: (err: Core.Error, res: Query.Response) => void): void; + /** + * Invoke a map/reduce function, which allows you to perform more complex queries + * on PouchDB than what you get with allDocs(). + */ + query(fun: string | ((doc: Content & Model) => void), opts?: Query.Options): Promise>; + /** + * Invoke a map/reduce function, which allows you to perform more complex queries + * on PouchDB than what you get with allDocs(). + */ + query(fun: Filter, opts?: Query.Options): Promise>; } }