From 794ec58cf540063045d60a0cb87027a9db47d64c Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Fri, 5 Aug 2022 11:03:25 -0700 Subject: [PATCH] Make bulkWrite's type parameter conditional Smaller alternative fix to #12212. Also fixes #12213, but unsafely when the model's type parameter allows null or undefined. --- types/models.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/models.d.ts b/types/models.d.ts index 41020013228..e4379b4c0de 100644 --- a/types/models.d.ts +++ b/types/models.d.ts @@ -144,9 +144,9 @@ declare module 'mongoose' { * if you use `create()`) because with `bulkWrite()` there is only one network * round trip to the MongoDB server. */ - bulkWrite(writes: Array>, options: mongodb.BulkWriteOptions & MongooseBulkWriteOptions, callback: Callback): void; - bulkWrite(writes: Array>, callback: Callback): void; - bulkWrite(writes: Array>, options?: mongodb.BulkWriteOptions & MongooseBulkWriteOptions): Promise; + bulkWrite(writes: Array>, options: mongodb.BulkWriteOptions & MongooseBulkWriteOptions, callback: Callback): void; + bulkWrite(writes: Array>, callback: Callback): void; + bulkWrite(writes: Array>, options?: mongodb.BulkWriteOptions & MongooseBulkWriteOptions): Promise; /** * Sends multiple `save()` calls in a single `bulkWrite()`. This is faster than