@@ -236,7 +236,7 @@ declare module 'mongoose' {
236
236
/**
237
237
* Create a new schema
238
238
*/
239
- constructor ( definition ?: SchemaDefinition < SchemaDefinitionType < EnforcedDocType > > | DocType , options ?: SchemaOptions < DocType , TInstanceMethods , TQueryHelpers , TStaticMethods , TVirtuals , THydratedDocumentType > | ResolveSchemaOptions < TSchemaOptions > ) ;
239
+ constructor ( definition ?: SchemaDefinition < SchemaDefinitionType < EnforcedDocType > , EnforcedDocType > | DocType , options ?: SchemaOptions < DocType , TInstanceMethods , TQueryHelpers , TStaticMethods , TVirtuals , THydratedDocumentType > | ResolveSchemaOptions < TSchemaOptions > ) ;
240
240
241
241
/** Adds key path / schema type pairs to this schema. */
242
242
add ( obj : SchemaDefinition < SchemaDefinitionType < EnforcedDocType > > | Schema , prefix ?: string ) : this;
@@ -300,7 +300,7 @@ declare module 'mongoose' {
300
300
methods : { [ F in keyof TInstanceMethods ] : TInstanceMethods [ F ] } & AnyObject ;
301
301
302
302
/** The original object passed to the schema constructor */
303
- obj : SchemaDefinition < SchemaDefinitionType < EnforcedDocType > > ;
303
+ obj : SchemaDefinition < SchemaDefinitionType < EnforcedDocType > , EnforcedDocType > ;
304
304
305
305
/** Gets/sets schema paths. */
306
306
path < ResultType extends SchemaType = SchemaType < any , THydratedDocumentType > > ( path : string ) : ResultType ;
@@ -484,26 +484,26 @@ declare module 'mongoose' {
484
484
? DateSchemaDefinition
485
485
: ( Function | string ) ;
486
486
487
- export type SchemaDefinitionProperty < T = undefined > = SchemaDefinitionWithBuiltInClass < T > |
488
- SchemaTypeOptions < T extends undefined ? any : T > |
487
+ export type SchemaDefinitionProperty < T = undefined , EnforcedDocType = any > = SchemaDefinitionWithBuiltInClass < T > |
488
+ SchemaTypeOptions < T extends undefined ? any : T , EnforcedDocType > |
489
489
typeof SchemaType |
490
490
Schema < any , any , any > |
491
491
Schema < any , any , any > [ ] |
492
- SchemaTypeOptions < T extends undefined ? any : Unpacked < T > > [ ] |
492
+ SchemaTypeOptions < T extends undefined ? any : Unpacked < T > , EnforcedDocType > [ ] |
493
493
Function [ ] |
494
- SchemaDefinition < T > |
495
- SchemaDefinition < Unpacked < T > > [ ] |
494
+ SchemaDefinition < T , EnforcedDocType > |
495
+ SchemaDefinition < Unpacked < T > , EnforcedDocType > [ ] |
496
496
typeof Schema . Types . Mixed |
497
- MixedSchemaTypeOptions ;
497
+ MixedSchemaTypeOptions < EnforcedDocType > ;
498
498
499
- export type SchemaDefinition < T = undefined > = T extends undefined
499
+ export type SchemaDefinition < T = undefined , EnforcedDocType = any > = T extends undefined
500
500
? { [ path : string ] : SchemaDefinitionProperty ; }
501
- : { [ path in keyof T ] ?: SchemaDefinitionProperty < T [ path ] > ; } ;
501
+ : { [ path in keyof T ] ?: SchemaDefinitionProperty < T [ path ] , EnforcedDocType > ; } ;
502
502
503
503
export type AnyArray < T > = T [ ] | ReadonlyArray < T > ;
504
504
export type ExtractMongooseArray < T > = T extends Types . Array < any > ? AnyArray < Unpacked < T > > : T ;
505
505
506
- export interface MixedSchemaTypeOptions extends SchemaTypeOptions < Schema . Types . Mixed > {
506
+ export interface MixedSchemaTypeOptions < EnforcedDocType > extends SchemaTypeOptions < Schema . Types . Mixed , EnforcedDocType > {
507
507
type : typeof Schema . Types . Mixed ;
508
508
}
509
509
0 commit comments