From 79c3a025a30bc24824a22d9175f05eb550c25a3f Mon Sep 17 00:00:00 2001 From: Dobes Vandermeer Date: Tue, 12 Jun 2018 17:14:34 -0700 Subject: [PATCH 1/2] Update generic type of map to reflect variable output type The output type of the contents of the Cursor should match the return type of the mapping function. See also https://github.com/DefinitelyTyped/DefinitelyTyped/issues/15991 --- types/mongodb/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/mongodb/index.d.ts b/types/mongodb/index.d.ts index 98aa2daca8..1ca0c2a8b8 100644 --- a/types/mongodb/index.d.ts +++ b/types/mongodb/index.d.ts @@ -1252,7 +1252,7 @@ export class Cursor extends Readable { /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#limit */ limit(value: number): Cursor; /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#map */ - map(transform: Function): Cursor; + map(transform: (T) => U ): Cursor; /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#max */ max(max: number): Cursor; /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#maxAwaitTimeMS */ From 42b5630be7becf7239d85cde8d594875d49f5894 Mon Sep 17 00:00:00 2001 From: Dobes Vandermeer Date: Wed, 13 Jun 2018 16:10:19 -0700 Subject: [PATCH 2/2] Remove extra whitespace --- types/mongodb/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/mongodb/index.d.ts b/types/mongodb/index.d.ts index 1ca0c2a8b8..273a0716b2 100644 --- a/types/mongodb/index.d.ts +++ b/types/mongodb/index.d.ts @@ -1252,7 +1252,7 @@ export class Cursor extends Readable { /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#limit */ limit(value: number): Cursor; /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#map */ - map(transform: (T) => U ): Cursor; + map(transform: (T) => U): Cursor; /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#max */ max(max: number): Cursor; /** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#maxAwaitTimeMS */