File tree 2 files changed +7
-2
lines changed
2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -1223,5 +1223,10 @@ async function gh13797() {
1223
1223
interface IUser {
1224
1224
name : string ;
1225
1225
}
1226
- const schema2 = new Schema < IUser > ( { name : { type : String , required : function ( ) { expectType < IUser > ( this ) ; return true } } } ) ;
1226
+ new Schema < IUser > ( { name : { type : String , required : function ( ) {
1227
+ expectType < IUser > ( this ) ; return true ;
1228
+ } } } ) ;
1229
+ new Schema < IUser > ( { name : { type : String , default : function ( ) {
1230
+ expectType < IUser > ( this ) ; return '' ;
1231
+ } } } ) ;
1227
1232
}
Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ declare module 'mongoose' {
80
80
* The default value for this path. If a function, Mongoose executes the function
81
81
* and uses the return value as the default.
82
82
*/
83
- default ?: DefaultType < T > | ( ( this : any , doc : any ) => DefaultType < T > ) | null ;
83
+ default ?: DefaultType < T > | ( ( this : EnforcedDocType , doc : any ) => DefaultType < T > ) | null ;
84
84
85
85
/**
86
86
* The model that `populate()` should use if populating this path.
You can’t perform that action at this time.
0 commit comments