diff --git a/test/types/querycursor.test.ts b/test/types/querycursor.test.ts index f63f38370e1..81978059071 100644 --- a/test/types/querycursor.test.ts +++ b/test/types/querycursor.test.ts @@ -21,6 +21,8 @@ Test.find().cursor(). }). then(() => console.log('Done!')); +Test.find().cursor().next().then((doc) => expectType(doc)); + async function gh14374() { // `Parent` represents the object as it is stored in MongoDB interface Parent { diff --git a/types/cursor.d.ts b/types/cursor.d.ts index 5c467b866d5..888dd04c79b 100644 --- a/types/cursor.d.ts +++ b/types/cursor.d.ts @@ -51,7 +51,7 @@ declare module 'mongoose' { * Get the next document from this cursor. Will return `null` when there are * no documents left. */ - next(): Promise; + next(): Promise; options: Options; }