mongoose 8.18.3 → 8.19.1
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.
- package/README.md +22 -0
- package/dist/browser.umd.js +1 -1
- package/lib/document.js +6 -2
- package/lib/helpers/query/castUpdate.js +7 -2
- package/lib/helpers/schema/getPath.js +4 -1
- package/lib/helpers/update/castArrayFilters.js +3 -4
- package/lib/helpers/update/decorateUpdateWithVersionKey.js +19 -10
- package/lib/model.js +16 -5
- package/lib/schema/documentArray.js +1 -1
- package/lib/schema/map.js +2 -2
- package/lib/schema/subdocument.js +1 -1
- package/lib/schemaType.js +1 -0
- package/package.json +10 -8
- package/types/index.d.ts +17 -8
- package/types/inferrawdoctype.d.ts +76 -95
- package/types/inferschematype.d.ts +214 -213
- package/types/models.d.ts +194 -26
- package/types/query.d.ts +76 -55
- package/types/schemaoptions.d.ts +3 -0
- package/types/schematypes.d.ts +86 -33
- package/types/utility.d.ts +108 -81
|
@@ -1,20 +1,27 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
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
|
-
|
|
7
|
+
Decimal128SchemaDefinition,
|
|
8
|
+
DefaultSchemaOptions,
|
|
13
9
|
DefaultTypeKey,
|
|
14
|
-
|
|
10
|
+
DoubleSchemaDefinition,
|
|
15
11
|
IfEquals,
|
|
16
|
-
|
|
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
|
-
> =
|
|
33
|
-
EnforcedDocType
|
|
34
|
-
{
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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<
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
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
|
|
79
|
-
:
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
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> =
|
|
97
|
-
|
|
98
|
-
PathType extends { default: (...args: any[]) => undefined } ?
|
|
99
|
-
|
|
100
|
-
|
|
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
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
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
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
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']> =
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
:
|
|
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> =
|
|
211
|
-
? true
|
|
212
|
-
: T extends
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
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<
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
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
|
+
>;
|