@@ -12,6 +12,7 @@ import {
12
12
ObtainDocumentType ,
13
13
DefaultTypeKey ,
14
14
ObjectIdSchemaDefinition ,
15
+ IfAny ,
15
16
IfEquals ,
16
17
DefaultSchemaOptions ,
17
18
IsItRecordAndNotAny
@@ -252,22 +253,22 @@ type ResolvePathType<PathValueType, Options extends SchemaTypeOptions<PathValueT
252
253
IfEquals < TypeHint , never ,
253
254
PathValueType extends Schema ? InferSchemaType < PathValueType > :
254
255
PathValueType extends ( infer Item ) [ ] ?
255
- IfEquals < Item , never , any [ ] , Item extends Schema ?
256
+ IfEquals < Item , never , Types . Array < any > , Item extends Schema ?
256
257
// If Item is a schema, infer its type.
257
258
Types . DocumentArray < InferSchemaType < Item > > :
258
259
Item extends Record < TypeKey , any > ?
259
260
Item [ TypeKey ] extends Function | String ?
260
261
// If Item has a type key that's a string or a callable, it must be a scalar,
261
262
// so we can directly obtain its path type.
262
- ObtainDocumentPathType < Item , TypeKey > [ ] :
263
+ Types . Array < ObtainDocumentPathType < Item , TypeKey > > :
263
264
// If the type key isn't callable, then this is an array of objects, in which case
264
265
// we need to call ObtainDocumentType to correctly infer its type.
265
266
Types . DocumentArray < ObtainDocumentType < Item , any , { typeKey : TypeKey } > > :
266
267
IsSchemaTypeFromBuiltinClass < Item > extends true ?
267
- ObtainDocumentPathType < Item , TypeKey > [ ] :
268
+ Types . Array < ObtainDocumentPathType < Item , TypeKey > > :
268
269
IsItRecordAndNotAny < Item > extends true ?
269
270
Item extends Record < string , never > ?
270
- ObtainDocumentPathType < Item , TypeKey > [ ] :
271
+ Types . Array < ObtainDocumentPathType < Item , TypeKey > > :
271
272
Types . DocumentArray < ObtainDocumentType < Item , any , { typeKey : TypeKey } > > :
272
273
ObtainDocumentPathType < Item , TypeKey > [ ]
273
274
> :
@@ -276,13 +277,13 @@ type ResolvePathType<PathValueType, Options extends SchemaTypeOptions<PathValueT
276
277
Types . DocumentArray < InferSchemaType < Item > > :
277
278
Item extends Record < TypeKey , any > ?
278
279
Item [ TypeKey ] extends Function | String ?
279
- ObtainDocumentPathType < Item , TypeKey > [ ] :
280
- ObtainDocumentType < Item , any , { typeKey : TypeKey } > [ ] :
280
+ Types . Array < ObtainDocumentPathType < Item , TypeKey > > :
281
+ Types . Array < ObtainDocumentType < Item , any , { typeKey : TypeKey } > > :
281
282
IsSchemaTypeFromBuiltinClass < Item > extends true ?
282
- ObtainDocumentPathType < Item , TypeKey > [ ] :
283
+ Types . Array < ObtainDocumentPathType < Item , TypeKey > > :
283
284
IsItRecordAndNotAny < Item > extends true ?
284
285
Item extends Record < string , never > ?
285
- ObtainDocumentPathType < Item , TypeKey > [ ] :
286
+ Types . Array < ObtainDocumentPathType < Item , TypeKey > > :
286
287
Types . DocumentArray < ObtainDocumentType < Item , any , { typeKey : TypeKey } > > :
287
288
ObtainDocumentPathType < Item , TypeKey > [ ]
288
289
> :
@@ -309,7 +310,7 @@ type ResolvePathType<PathValueType, Options extends SchemaTypeOptions<PathValueT
309
310
IfEquals < PathValueType , Schema . Types . UUID > extends true ? Buffer :
310
311
PathValueType extends MapConstructor | 'Map' ? Map < string , ResolvePathType < Options [ 'of' ] > > :
311
312
IfEquals < PathValueType , typeof Schema . Types . Map > extends true ? Map < string , ResolvePathType < Options [ 'of' ] > > :
312
- PathValueType extends ArrayConstructor ? any [ ] :
313
+ PathValueType extends ArrayConstructor ? Types . Array < any > :
313
314
PathValueType extends typeof Schema . Types . Mixed ? any :
314
315
IfEquals < PathValueType , ObjectConstructor > extends true ? any :
315
316
IfEquals < PathValueType , { } > extends true ? any :
0 commit comments