File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -1379,3 +1379,15 @@ function gh14147() {
1379
1379
const doc = new AffiliateModel ( ) ;
1380
1380
expectType < bigint > ( doc . balance ) ;
1381
1381
}
1382
+
1383
+ function gh14235 ( ) {
1384
+ interface IUser {
1385
+ name : string ;
1386
+ age : number ;
1387
+ }
1388
+
1389
+ const userSchema = new Schema < IUser > ( { name : String , age : Number } ) ;
1390
+
1391
+ userSchema . omit < Omit < IUser , 'age' > > ( [ 'age' ] ) ;
1392
+ }
1393
+
Original file line number Diff line number Diff line change @@ -302,6 +302,9 @@ declare module 'mongoose' {
302
302
/** The original object passed to the schema constructor */
303
303
obj : SchemaDefinition < SchemaDefinitionType < EnforcedDocType > , EnforcedDocType > ;
304
304
305
+ /** Returns a new schema that has the `paths` from the original schema, minus the omitted ones. */
306
+ omit < T = this> ( paths : string [ ] , options ?: SchemaOptions ) : T ;
307
+
305
308
/** Gets/sets schema paths. */
306
309
path < ResultType extends SchemaType = SchemaType < any , THydratedDocumentType > > ( path : string ) : ResultType ;
307
310
path < pathGeneric extends keyof EnforcedDocType > ( path : pathGeneric ) : SchemaType < EnforcedDocType [ pathGeneric ] > ;
You can’t perform that action at this time.
0 commit comments