File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import mongoose, {
9
9
CallbackError ,
10
10
HydratedDocument ,
11
11
HydratedDocumentFromSchema ,
12
+ InsertManyResult ,
12
13
Query ,
13
14
UpdateWriteOpResult ,
14
15
AggregateOptions ,
@@ -709,3 +710,20 @@ async function gh13746() {
709
710
expectType < ObjectId | undefined > ( findOneAndUpdateRes . lastErrorObject ?. upserted ) ;
710
711
expectType < OkType > ( findOneAndUpdateRes . ok ) ;
711
712
}
713
+
714
+ function gh13904 ( ) {
715
+ const schema = new Schema ( { name : String } ) ;
716
+
717
+ interface ITest {
718
+ name ?: string ;
719
+ }
720
+ const Test = model < ITest > ( "Test" , schema ) ;
721
+
722
+ expectAssignable < Promise < InsertManyResult < ITest > > > ( Test . insertMany (
723
+ [ { name : "test" } ] ,
724
+ {
725
+ ordered : false ,
726
+ rawResult : true
727
+ }
728
+ ) ) ;
729
+ }
Original file line number Diff line number Diff line change @@ -375,7 +375,7 @@ declare module 'mongoose' {
375
375
options : InsertManyOptions & { ordered : false ; rawResult : true ; }
376
376
) : Promise < mongodb . InsertManyResult < Require_id < DocContents > > & {
377
377
mongoose : {
378
- validationErrors : Error [ ] ;
378
+ validationErrors : ( CastError | Error . ValidatorError ) [ ] ;
379
379
results : Array <
380
380
Error |
381
381
Object |
You can’t perform that action at this time.
0 commit comments