diff --git a/types/pouchdb-mapreduce/index.d.ts b/types/pouchdb-mapreduce/index.d.ts index 4c3d2e8ebf..92ea09e172 100644 --- a/types/pouchdb-mapreduce/index.d.ts +++ b/types/pouchdb-mapreduce/index.d.ts @@ -11,11 +11,17 @@ declare namespace PouchDB { type Map = (doc: Content) => void; - // The any below would be the value type from emit(key, value), currently hidden from type information in the Map - type Reducer = (keys: Array<[string, any]> | null, values: Content[] | Reduction[], rereduce: boolean) => Reduction[] | Reduction; + /** + * CouchDB-style Reduction function + * + * @param keys From CouchDB documentation: Array of pairs of docid-key for related map function results; + * PouchDB may pass a simple array and also supports complex keys. + */ + type Reducer = (keys: any | null, values: Content[] | Reduction[], rereduce: boolean) => Reduction[] | Reduction; interface Filter { map: Map; + // Assume that Content[] | Reduction[] is enough leverage in most cases to handle intermediate map emits reduce?: Reducer | '_sum' | '_count' | '_stats' | string; }