mongoose 8.18.3 → 8.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,20 +1,27 @@
1
1
  import {
2
- Schema,
3
- InferSchemaType,
4
- SchemaType,
5
- SchemaTypeOptions,
6
- TypeKeyBaseType,
7
- Types,
8
- NumberSchemaDefinition,
9
- StringSchemaDefinition,
2
+ AnyArray,
10
3
  BooleanSchemaDefinition,
4
+ BigintSchemaDefinition,
5
+ BufferSchemaDefinition,
11
6
  DateSchemaDefinition,
12
- ObtainDocumentType,
7
+ Decimal128SchemaDefinition,
8
+ DefaultSchemaOptions,
13
9
  DefaultTypeKey,
14
- ObjectIdSchemaDefinition,
10
+ DoubleSchemaDefinition,
15
11
  IfEquals,
16
- DefaultSchemaOptions,
17
- IsItRecordAndNotAny
12
+ InferSchemaType,
13
+ IsItRecordAndNotAny,
14
+ MapSchemaDefinition,
15
+ NumberSchemaDefinition,
16
+ ObjectIdSchemaDefinition,
17
+ ObtainDocumentType,
18
+ Schema,
19
+ SchemaType,
20
+ SchemaTypeOptions,
21
+ StringSchemaDefinition,
22
+ Types,
23
+ UnionSchemaDefinition,
24
+ UuidSchemaDefinition
18
25
  } from 'mongoose';
19
26
 
20
27
  declare module 'mongoose' {
@@ -29,16 +36,17 @@ declare module 'mongoose' {
29
36
  DocDefinition,
30
37
  EnforcedDocType = any,
31
38
  TSchemaOptions extends Record<any, any> = DefaultSchemaOptions
32
- > = IsItRecordAndNotAny<EnforcedDocType> extends true ?
33
- EnforcedDocType :
34
- {
35
- [
36
- K in keyof (RequiredPaths<DocDefinition, TSchemaOptions['typeKey']> &
37
- OptionalPaths<DocDefinition, TSchemaOptions['typeKey']>)
38
- ]: IsPathRequired<DocDefinition[K], TSchemaOptions['typeKey']> extends true ?
39
- ObtainDocumentPathType<DocDefinition[K], TSchemaOptions['typeKey']> :
40
- ObtainDocumentPathType<DocDefinition[K], TSchemaOptions['typeKey']> | null;
41
- };
39
+ > =
40
+ IsItRecordAndNotAny<EnforcedDocType> extends true ? EnforcedDocType
41
+ : {
42
+ [K in keyof (RequiredPaths<DocDefinition, TSchemaOptions['typeKey']> &
43
+ OptionalPaths<DocDefinition, TSchemaOptions['typeKey']>)]: IsPathRequired<
44
+ DocDefinition[K],
45
+ TSchemaOptions['typeKey']
46
+ > extends true ?
47
+ ObtainDocumentPathType<DocDefinition[K], TSchemaOptions['typeKey']>
48
+ : ObtainDocumentPathType<DocDefinition[K], TSchemaOptions['typeKey']> | null;
49
+ };
42
50
 
43
51
  /**
44
52
  * @summary Obtains document schema type from Schema instance.
@@ -56,48 +64,80 @@ declare module 'mongoose' {
56
64
  * @param {TSchema} TSchema A generic of schema type instance.
57
65
  * @param {alias} alias Targeted generic alias.
58
66
  */
59
- type ObtainSchemaGeneric<TSchema, alias extends 'EnforcedDocType' | 'M' | 'TInstanceMethods' | 'TQueryHelpers' | 'TVirtuals' | 'TStaticMethods' | 'TSchemaOptions' | 'DocType' | 'THydratedDocumentType'> =
60
- TSchema extends Schema<infer EnforcedDocType, infer M, infer TInstanceMethods, infer TQueryHelpers, infer TVirtuals, infer TStaticMethods, infer TSchemaOptions, infer DocType, infer THydratedDocumentType>
61
- ? {
62
- EnforcedDocType: EnforcedDocType;
63
- M: M;
64
- TInstanceMethods: TInstanceMethods;
65
- TQueryHelpers: TQueryHelpers;
66
- TVirtuals: TVirtuals;
67
- TStaticMethods: TStaticMethods;
68
- TSchemaOptions: TSchemaOptions;
69
- DocType: DocType;
70
- THydratedDocumentType: THydratedDocumentType;
71
- }[alias]
72
- : unknown;
67
+ type ObtainSchemaGeneric<
68
+ TSchema,
69
+ alias extends
70
+ | 'EnforcedDocType'
71
+ | 'M'
72
+ | 'TInstanceMethods'
73
+ | 'TQueryHelpers'
74
+ | 'TVirtuals'
75
+ | 'TStaticMethods'
76
+ | 'TSchemaOptions'
77
+ | 'DocType'
78
+ | 'THydratedDocumentType'
79
+ > =
80
+ TSchema extends (
81
+ Schema<
82
+ infer EnforcedDocType,
83
+ infer M,
84
+ infer TInstanceMethods,
85
+ infer TQueryHelpers,
86
+ infer TVirtuals,
87
+ infer TStaticMethods,
88
+ infer TSchemaOptions,
89
+ infer DocType,
90
+ infer THydratedDocumentType
91
+ >
92
+ ) ?
93
+ {
94
+ EnforcedDocType: EnforcedDocType;
95
+ M: M;
96
+ TInstanceMethods: TInstanceMethods;
97
+ TQueryHelpers: TQueryHelpers;
98
+ TVirtuals: TVirtuals;
99
+ TStaticMethods: TStaticMethods;
100
+ TSchemaOptions: TSchemaOptions;
101
+ DocType: DocType;
102
+ THydratedDocumentType: THydratedDocumentType;
103
+ }[alias]
104
+ : unknown;
73
105
 
74
106
  type ResolveSchemaOptions<T> = MergeType<DefaultSchemaOptions, T>;
75
107
 
76
108
  type ApplySchemaOptions<T, O = DefaultSchemaOptions> = ResolveTimestamps<T, O>;
77
109
 
78
- type ResolveTimestamps<T, O> = O extends { timestamps?: false } ? T
79
- : O extends { timestamps: infer TimestampOptions } ? TimestampOptions extends true
80
- ? { createdAt: NativeDate; updatedAt: NativeDate; } & T
81
- : TimestampOptions extends SchemaTimestampsConfig
82
- ? {
83
- -readonly [K in keyof Pick<
84
- TimestampOptions,
85
- 'createdAt' | 'updatedAt'
86
- > as TimestampOptions[K] extends true
87
- ? K
88
- : TimestampOptions[K] extends `${infer TimestampValue}`
89
- ? TimestampValue
90
- : never]: NativeDate;
91
- } & T
92
- : T
93
- : T;
110
+ type DefaultTimestampProps = {
111
+ createdAt: NativeDate;
112
+ updatedAt: NativeDate;
113
+ };
114
+
115
+ type ResolveTimestamps<T, O> =
116
+ O extends { timestamps?: false } ? T
117
+ : O extends { timestamps: infer TimestampOptions } ?
118
+ TimestampOptions extends true ? T & DefaultTimestampProps
119
+ : TimestampOptions extends SchemaTimestampsConfig ?
120
+ Show<
121
+ T & {
122
+ [K in keyof TimestampOptions & keyof DefaultTimestampProps as TimestampOptions[K] extends true ? K
123
+ : TimestampOptions[K] & string]: NativeDate;
124
+ }
125
+ >
126
+ : T
127
+ : T;
94
128
  }
95
129
 
96
- type IsPathDefaultUndefined<PathType> = PathType extends { default: undefined } ?
97
- true :
98
- PathType extends { default: (...args: any[]) => undefined } ?
99
- true :
100
- false;
130
+ type IsPathDefaultUndefined<PathType> =
131
+ PathType extends { default: undefined } ? true
132
+ : PathType extends { default: (...args: any[]) => undefined } ? true
133
+ : false;
134
+
135
+ type RequiredPropertyDefinition =
136
+ | {
137
+ required: true | string | [true, string | undefined] | { isRequired: true };
138
+ }
139
+ | ArrayConstructor
140
+ | any[];
101
141
 
102
142
  /**
103
143
  * @summary Checks if a document path is required or optional.
@@ -105,28 +145,20 @@ type IsPathDefaultUndefined<PathType> = PathType extends { default: undefined }
105
145
  * @param {TypeKey} TypeKey A generic of literal string type."Refers to the property used for path type definition".
106
146
  */
107
147
  type IsPathRequired<P, TypeKey extends string = DefaultTypeKey> =
108
- P extends { required: true | string | [true, string | undefined] | { isRequired: true } } | ArrayConstructor | any[]
109
- ? true
110
- : P extends { required: boolean }
111
- ? P extends { required: false }
112
- ? false
113
- : true
114
- : P extends (Record<TypeKey, ArrayConstructor | any[]>)
115
- ? IsPathDefaultUndefined<P> extends true
116
- ? false
117
- : true
118
- : P extends (Record<TypeKey, any>)
119
- ? P extends { default: any }
120
- ? IfEquals<P['default'], undefined, false, true>
121
- : false
122
- : false;
123
-
124
- /**
125
- * @summary Path base type defined by using TypeKey
126
- * @description It helps to check if a path is defined by TypeKey OR not.
127
- * @param {TypeKey} TypeKey A literal string refers to path type property key.
128
- */
129
- type PathWithTypePropertyBaseType<TypeKey extends string = DefaultTypeKey> = { [k in TypeKey]: any };
148
+ P extends RequiredPropertyDefinition ? true
149
+ : P extends { required: boolean } ?
150
+ P extends { required: false } ?
151
+ false
152
+ : true
153
+ : P extends Record<TypeKey, ArrayConstructor | any[]> ?
154
+ IsPathDefaultUndefined<P> extends true ?
155
+ false
156
+ : true
157
+ : P extends Record<TypeKey, any> ?
158
+ P extends { default: any } ?
159
+ IfEquals<P['default'], undefined, false, true>
160
+ : false
161
+ : false;
130
162
 
131
163
  /**
132
164
  * @summary A Utility to obtain schema's required path keys.
@@ -134,9 +166,7 @@ type PathWithTypePropertyBaseType<TypeKey extends string = DefaultTypeKey> = { [
134
166
  * @param {TypeKey} TypeKey A generic of literal string type."Refers to the property used for path type definition".
135
167
  * @returns required paths keys of document definition.
136
168
  */
137
- type RequiredPathKeys<T, TypeKey extends string = DefaultTypeKey> = {
138
- [K in keyof T]: IsPathRequired<T[K], TypeKey> extends true ? IfEquals<T[K], any, never, K> : never;
139
- }[keyof T];
169
+ type RequiredPathKeys<T, TypeKey extends string = DefaultTypeKey> = Exclude<keyof T, OptionalPathKeys<T, TypeKey>>;
140
170
 
141
171
  /**
142
172
  * @summary A Utility to obtain schema's required paths.
@@ -173,8 +203,7 @@ type OptionalPaths<T, TypeKey extends string = DefaultTypeKey> = Pick<
173
203
  /**
174
204
  * @summary Allows users to optionally choose their own type for a schema field for stronger typing.
175
205
  */
176
- type TypeHint<T> = T extends { __typehint: infer U } ? U: never;
177
-
206
+ type TypeHint<T> = T extends { __typehint: infer U } ? U : never;
178
207
 
179
208
  /**
180
209
  * @summary Obtains schema Path type.
@@ -183,71 +212,51 @@ type TypeHint<T> = T extends { __typehint: infer U } ? U: never;
183
212
  * @param {TypeKey} TypeKey A generic refers to document definition.
184
213
  */
185
214
  type ObtainDocumentPathType<PathValueType, TypeKey extends string = DefaultTypeKey> = ResolvePathType<
186
- PathValueType extends PathWithTypePropertyBaseType<TypeKey>
187
- ? PathValueType[TypeKey] extends PathWithTypePropertyBaseType<TypeKey>
188
- ? PathValueType
189
- : PathValueType[TypeKey]
190
- : PathValueType,
191
- PathValueType extends PathWithTypePropertyBaseType<TypeKey>
192
- ? PathValueType[TypeKey] extends PathWithTypePropertyBaseType<TypeKey>
193
- ? {}
194
- : Omit<PathValueType, TypeKey>
195
- : {},
196
- TypeKey,
197
- TypeHint<PathValueType>
215
+ TypeKey extends keyof PathValueType ?
216
+ TypeKey extends keyof PathValueType[TypeKey] ?
217
+ PathValueType
218
+ : PathValueType[TypeKey]
219
+ : PathValueType,
220
+ TypeKey extends keyof PathValueType ?
221
+ TypeKey extends keyof PathValueType[TypeKey] ?
222
+ {}
223
+ : Omit<PathValueType, TypeKey>
224
+ : {},
225
+ TypeKey,
226
+ TypeHint<PathValueType>
198
227
  >;
199
228
 
200
229
  /**
201
230
  * @param {T} T A generic refers to string path enums.
202
231
  * @returns Path enum values type as literal strings or string.
203
232
  */
204
- type PathEnumOrString<T extends SchemaTypeOptions<string>['enum']> = T extends ReadonlyArray<infer E> ? E : T extends { values: any } ? PathEnumOrString<T['values']> : T extends Record<string, infer V> ? V : string;
205
-
206
- type UnionToType<T extends readonly any[]> = T[number] extends infer U
207
- ? ResolvePathType<U>
208
- : never;
233
+ type PathEnumOrString<T extends SchemaTypeOptions<string>['enum']> =
234
+ T extends ReadonlyArray<infer E> ? E
235
+ : T extends { values: any } ? PathEnumOrString<T['values']>
236
+ : T extends Record<string, infer V> ? V
237
+ : string;
209
238
 
210
- type IsSchemaTypeFromBuiltinClass<T> = T extends (typeof String)
211
- ? true
212
- : T extends (typeof Number)
213
- ? true
214
- : T extends (typeof Boolean)
215
- ? true
216
- : T extends (typeof Buffer)
217
- ? true
218
- : T extends (typeof Schema.Types.ObjectId)
219
- ? true
220
- : T extends (typeof Schema.Types.UUID)
221
- ? true
222
- : T extends (typeof Schema.Types.Decimal128)
223
- ? true
224
- : T extends (typeof Schema.Types.Int32)
225
- ? true
226
- : T extends (typeof Schema.Types.String)
227
- ? true
228
- : T extends (typeof Schema.Types.Number)
229
- ? true
230
- : T extends (typeof Schema.Types.Date)
231
- ? true
232
- : T extends (typeof Schema.Types.Double)
233
- ? true
234
- : T extends (typeof Schema.Types.Boolean)
235
- ? true
236
- : T extends Types.ObjectId
237
- ? true
238
- : T extends Types.Decimal128
239
- ? true
240
- : T extends NativeDate
241
- ? true
242
- : T extends (typeof Schema.Types.Mixed)
243
- ? true
244
- : IfEquals<T, Schema.Types.ObjectId, true, false> extends true
245
- ? true
246
- : unknown extends Buffer
247
- ? false
248
- : T extends Buffer
249
- ? true
250
- : false;
239
+ type IsSchemaTypeFromBuiltinClass<T> =
240
+ T extends typeof String ? true
241
+ : T extends typeof Number ? true
242
+ : T extends typeof Boolean ? true
243
+ : T extends typeof Buffer ? true
244
+ : T extends typeof Schema.Types.ObjectId ? true
245
+ : T extends typeof Schema.Types.UUID ? true
246
+ : T extends typeof Schema.Types.Decimal128 ? true
247
+ : T extends typeof Schema.Types.Int32 ? true
248
+ : T extends typeof Schema.Types.String ? true
249
+ : T extends typeof Schema.Types.Number ? true
250
+ : T extends typeof Schema.Types.Date ? true
251
+ : T extends typeof Schema.Types.Double ? true
252
+ : T extends typeof Schema.Types.Boolean ? true
253
+ : T extends Types.ObjectId ? true
254
+ : T extends Types.Decimal128 ? true
255
+ : T extends NativeDate ? true
256
+ : T extends typeof Schema.Types.Mixed ? true
257
+ : unknown extends Buffer ? false
258
+ : T extends Buffer ? true
259
+ : false;
251
260
 
252
261
  /**
253
262
  * @summary Resolve path type by returning the corresponding type.
@@ -256,74 +265,66 @@ type IsSchemaTypeFromBuiltinClass<T> = T extends (typeof String)
256
265
  * @param {TypeKey} TypeKey A generic of literal string type."Refers to the property used for path type definition".
257
266
  * @returns Number, "Number" or "number" will be resolved to number type.
258
267
  */
259
- type ResolvePathType<PathValueType, Options extends SchemaTypeOptions<PathValueType> = {}, TypeKey extends string = DefaultSchemaOptions['typeKey'], TypeHint = never> =
260
- IfEquals<TypeHint, never,
261
- PathValueType extends Schema ? InferSchemaType<PathValueType> :
262
- PathValueType extends (infer Item)[] ?
263
- IfEquals<Item, never, any[], Item extends Schema ?
264
- // If Item is a schema, infer its type.
265
- Types.DocumentArray<InferSchemaType<Item>> :
266
- Item extends Record<TypeKey, any> ?
267
- Item[TypeKey] extends Function | String ?
268
- // If Item has a type key that's a string or a callable, it must be a scalar,
269
- // so we can directly obtain its path type.
270
- ObtainDocumentPathType<Item, TypeKey>[] :
271
- // If the type key isn't callable, then this is an array of objects, in which case
272
- // we need to call ObtainDocumentType to correctly infer its type.
273
- Types.DocumentArray<ObtainDocumentType<Item, any, { typeKey: TypeKey }>> :
274
- IsSchemaTypeFromBuiltinClass<Item> extends true ?
275
- ResolvePathType<Item, { enum: Options['enum'] }, TypeKey>[] :
276
- IsItRecordAndNotAny<Item> extends true ?
277
- Item extends Record<string, never> ?
278
- ObtainDocumentPathType<Item, TypeKey>[] :
279
- Types.DocumentArray<ObtainDocumentType<Item, any, { typeKey: TypeKey }>> :
280
- ObtainDocumentPathType<Item, TypeKey>[]
281
- >:
282
- PathValueType extends ReadonlyArray<infer Item> ?
283
- IfEquals<Item, never, any[], Item extends Schema ?
284
- Types.DocumentArray<InferSchemaType<Item>> :
285
- Item extends Record<TypeKey, any> ?
286
- Item[TypeKey] extends Function | String ?
287
- ObtainDocumentPathType<Item, TypeKey>[] :
288
- ObtainDocumentType<Item, any, { typeKey: TypeKey }>[]:
289
- IsSchemaTypeFromBuiltinClass<Item> extends true ?
290
- ObtainDocumentPathType<Item, TypeKey>[] :
291
- IsItRecordAndNotAny<Item> extends true ?
292
- Item extends Record<string, never> ?
293
- ObtainDocumentPathType<Item, TypeKey>[] :
294
- Types.DocumentArray<ObtainDocumentType<Item, any, { typeKey: TypeKey }>> :
295
- ObtainDocumentPathType<Item, TypeKey>[]
296
- >:
297
- PathValueType extends StringSchemaDefinition ? PathEnumOrString<Options['enum']> :
298
- IfEquals<PathValueType, Schema.Types.String> extends true ? PathEnumOrString<Options['enum']> :
299
- IfEquals<PathValueType, String> extends true ? PathEnumOrString<Options['enum']> :
300
- PathValueType extends NumberSchemaDefinition ? Options['enum'] extends ReadonlyArray<any> ? Options['enum'][number] : number :
301
- IfEquals<PathValueType, Schema.Types.Number> extends true ? number :
302
- PathValueType extends DateSchemaDefinition ? NativeDate :
303
- IfEquals<PathValueType, Schema.Types.Date> extends true ? NativeDate :
304
- PathValueType extends typeof Buffer | 'buffer' | 'Buffer' | typeof Schema.Types.Buffer ? Buffer :
305
- PathValueType extends BooleanSchemaDefinition ? boolean :
306
- IfEquals<PathValueType, Schema.Types.Boolean> extends true ? boolean :
307
- PathValueType extends ObjectIdSchemaDefinition ? Types.ObjectId :
308
- IfEquals<PathValueType, Types.ObjectId> extends true ? Types.ObjectId :
309
- IfEquals<PathValueType, Schema.Types.ObjectId> extends true ? Types.ObjectId :
310
- PathValueType extends 'decimal128' | 'Decimal128' | typeof Schema.Types.Decimal128 ? Types.Decimal128 :
311
- IfEquals<PathValueType, Schema.Types.Decimal128> extends true ? Types.Decimal128 :
312
- IfEquals<PathValueType, Types.Decimal128> extends true ? Types.Decimal128 :
313
- IfEquals<PathValueType, Schema.Types.BigInt> extends true ? bigint :
314
- IfEquals<PathValueType, BigInt> extends true ? bigint :
315
- PathValueType extends 'bigint' | 'BigInt' | typeof Schema.Types.BigInt | typeof BigInt ? bigint :
316
- PathValueType extends 'uuid' | 'UUID' | typeof Schema.Types.UUID ? Buffer :
317
- PathValueType extends 'double' | 'Double' | typeof Schema.Types.Double ? Types.Double :
318
- IfEquals<PathValueType, Schema.Types.UUID> extends true ? Buffer :
319
- PathValueType extends MapConstructor | 'Map' ? Map<string, ObtainDocumentPathType<Options['of']>> :
320
- IfEquals<PathValueType, typeof Schema.Types.Map> extends true ? Map<string, ObtainDocumentPathType<Options['of']>> :
321
- PathValueType extends 'Union' | 'union' | typeof Schema.Types.Union ? Options['of'] extends readonly any[] ? UnionToType<Options['of']> : never :
322
- PathValueType extends ArrayConstructor ? any[] :
323
- PathValueType extends typeof Schema.Types.Mixed ? any:
324
- IfEquals<PathValueType, ObjectConstructor> extends true ? any:
325
- IfEquals<PathValueType, {}> extends true ? any:
326
- PathValueType extends typeof SchemaType ? PathValueType['prototype'] :
327
- PathValueType extends Record<string, any> ? ObtainDocumentType<PathValueType, any, { typeKey: TypeKey }> :
328
- unknown,
329
- TypeHint>;
268
+ type ResolvePathType<
269
+ PathValueType,
270
+ Options extends SchemaTypeOptions<PathValueType> = {},
271
+ TypeKey extends string = DefaultSchemaOptions['typeKey'],
272
+ TypeHint = never
273
+ > = IfEquals<
274
+ TypeHint,
275
+ never,
276
+ PathValueType extends Schema ? InferSchemaType<PathValueType>
277
+ : PathValueType extends AnyArray<infer Item> ?
278
+ IfEquals<Item, never> extends true
279
+ ? any[]
280
+ : Item extends Schema ?
281
+ // If Item is a schema, infer its type.
282
+ Types.DocumentArray<InferSchemaType<Item>>
283
+ : Item extends Record<TypeKey, any> ?
284
+ Item[TypeKey] extends Function | String ?
285
+ // If Item has a type key that's a string or a callable, it must be a scalar,
286
+ // so we can directly obtain its path type.
287
+ ObtainDocumentPathType<Item, TypeKey>[]
288
+ : // If the type key isn't callable, then this is an array of objects, in which case
289
+ // we need to call ObtainDocumentType to correctly infer its type.
290
+ Types.DocumentArray<ObtainDocumentType<Item, any, { typeKey: TypeKey }>>
291
+ : IsSchemaTypeFromBuiltinClass<Item> extends true ? ResolvePathType<Item, { enum: Options['enum'] }, TypeKey>[]
292
+ : IsItRecordAndNotAny<Item> extends true ?
293
+ Item extends Record<string, never> ?
294
+ ObtainDocumentPathType<Item, TypeKey>[]
295
+ : Types.DocumentArray<ObtainDocumentType<Item, any, { typeKey: TypeKey }>>
296
+ : ObtainDocumentPathType<Item, TypeKey>[]
297
+ : PathValueType extends StringSchemaDefinition ? PathEnumOrString<Options['enum']>
298
+ : IfEquals<PathValueType, String> extends true ? PathEnumOrString<Options['enum']>
299
+ : PathValueType extends NumberSchemaDefinition ?
300
+ Options['enum'] extends ReadonlyArray<any> ?
301
+ Options['enum'][number]
302
+ : number
303
+ : PathValueType extends DateSchemaDefinition ? NativeDate
304
+ : PathValueType extends BufferSchemaDefinition ? Buffer
305
+ : PathValueType extends BooleanSchemaDefinition ? boolean
306
+ : PathValueType extends ObjectIdSchemaDefinition ? Types.ObjectId
307
+ : PathValueType extends Decimal128SchemaDefinition ? Types.Decimal128
308
+ : PathValueType extends BigintSchemaDefinition ? bigint
309
+ : PathValueType extends UuidSchemaDefinition ? Buffer
310
+ : PathValueType extends DoubleSchemaDefinition ? Types.Double
311
+ : PathValueType extends MapSchemaDefinition ? Map<string, ObtainDocumentPathType<Options['of']>>
312
+ : PathValueType extends UnionSchemaDefinition ?
313
+ Options['of'] extends AnyArray<infer U> ? ResolvePathType<U>
314
+ : never
315
+ : PathValueType extends ArrayConstructor ? any[]
316
+ : PathValueType extends typeof Schema.Types.Mixed ? any
317
+ : IfEquals<PathValueType, ObjectConstructor> extends true ? any
318
+ : IfEquals<PathValueType, {}> extends true ? any
319
+ : PathValueType extends typeof SchemaType ? PathValueType['prototype']
320
+ : PathValueType extends Record<string, any> ?
321
+ ObtainDocumentType<
322
+ PathValueType,
323
+ any,
324
+ {
325
+ typeKey: TypeKey;
326
+ }
327
+ >
328
+ : unknown,
329
+ TypeHint
330
+ >;