Skip to content

Commit 7c6ff5c

Browse files
requested changes 4
1 parent 8226905 commit 7c6ff5c

File tree

3 files changed

+33
-42
lines changed

3 files changed

+33
-42
lines changed

docs/source/api.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ const files = [
4141
'lib/types/arraySubdocument.js',
4242
'lib/types/buffer.js',
4343
'lib/types/decimal128.js',
44-
'lib/types/int32.js',
4544
'lib/types/map.js',
4645
'lib/types/array/methods/index.js'
4746
];

types/inferrawdoctype.d.ts

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -102,21 +102,18 @@ declare module 'mongoose' {
102102
PathValueType extends 'decimal128' | 'Decimal128' | typeof Schema.Types.Decimal128 ? Types.Decimal128 :
103103
IfEquals<PathValueType, Schema.Types.Decimal128> extends true ? Types.Decimal128 :
104104
IfEquals<PathValueType, Types.Decimal128> extends true ? Types.Decimal128 :
105-
PathValueType extends 'int32' | 'Int32' | typeof Schema.Types.Int32 ? Types.Int32 :
106-
IfEquals<PathValueType, Schema.Types.Int32> extends true ? Types.Int32 :
107-
IfEquals<PathValueType, Types.Int32> extends true ? Types.Int32 :
108-
IfEquals<PathValueType, Schema.Types.BigInt> extends true ? bigint :
109-
IfEquals<PathValueType, BigInt> extends true ? bigint :
110-
PathValueType extends 'bigint' | 'BigInt' | typeof Schema.Types.BigInt | typeof BigInt ? bigint :
111-
PathValueType extends 'uuid' | 'UUID' | typeof Schema.Types.UUID ? Buffer :
112-
IfEquals<PathValueType, Schema.Types.UUID> extends true ? Buffer :
113-
PathValueType extends MapConstructor | 'Map' ? Map<string, ResolveRawPathType<Options['of']>> :
114-
IfEquals<PathValueType, typeof Schema.Types.Map> extends true ? Map<string, ResolveRawPathType<Options['of']>> :
115-
PathValueType extends ArrayConstructor ? any[] :
116-
PathValueType extends typeof Schema.Types.Mixed ? any:
117-
IfEquals<PathValueType, ObjectConstructor> extends true ? any:
118-
IfEquals<PathValueType, {}> extends true ? any:
119-
PathValueType extends typeof SchemaType ? PathValueType['prototype'] :
120-
PathValueType extends Record<string, any> ? ObtainDocumentType<PathValueType, any, { typeKey: TypeKey }> :
121-
unknown;
105+
IfEquals<PathValueType, Schema.Types.BigInt> extends true ? bigint :
106+
IfEquals<PathValueType, BigInt> extends true ? bigint :
107+
PathValueType extends 'bigint' | 'BigInt' | typeof Schema.Types.BigInt | typeof BigInt ? bigint :
108+
PathValueType extends 'uuid' | 'UUID' | typeof Schema.Types.UUID ? Buffer :
109+
IfEquals<PathValueType, Schema.Types.UUID> extends true ? Buffer :
110+
PathValueType extends MapConstructor | 'Map' ? Map<string, ResolveRawPathType<Options['of']>> :
111+
IfEquals<PathValueType, typeof Schema.Types.Map> extends true ? Map<string, ResolveRawPathType<Options['of']>> :
112+
PathValueType extends ArrayConstructor ? any[] :
113+
PathValueType extends typeof Schema.Types.Mixed ? any:
114+
IfEquals<PathValueType, ObjectConstructor> extends true ? any:
115+
IfEquals<PathValueType, {}> extends true ? any:
116+
PathValueType extends typeof SchemaType ? PathValueType['prototype'] :
117+
PathValueType extends Record<string, any> ? ObtainDocumentType<PathValueType, any, { typeKey: TypeKey }> :
118+
unknown;
122119
}

types/inferschematype.d.ts

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -235,15 +235,13 @@ type IsSchemaTypeFromBuiltinClass<T> = T extends (typeof String)
235235
? true
236236
: T extends Types.Decimal128
237237
? true
238-
: T extends Types.Int32
238+
: T extends Buffer
239239
? true
240-
: T extends Buffer
240+
: T extends NativeDate
241241
? true
242-
: T extends NativeDate
242+
: T extends (typeof Schema.Types.Mixed)
243243
? true
244-
: T extends (typeof Schema.Types.Mixed)
245-
? true
246-
: IfEquals<T, Schema.Types.ObjectId, true, false>;
244+
: IfEquals<T, Schema.Types.ObjectId, true, false>;
247245

248246
/**
249247
* @summary Resolve path type by returning the corresponding type.
@@ -306,21 +304,18 @@ type ResolvePathType<PathValueType, Options extends SchemaTypeOptions<PathValueT
306304
PathValueType extends 'decimal128' | 'Decimal128' | typeof Schema.Types.Decimal128 ? Types.Decimal128 :
307305
IfEquals<PathValueType, Schema.Types.Decimal128> extends true ? Types.Decimal128 :
308306
IfEquals<PathValueType, Types.Decimal128> extends true ? Types.Decimal128 :
309-
PathValueType extends 'int32' | 'Int32' | typeof Schema.Types.Int32 ? Types.Int32 :
310-
IfEquals<PathValueType, Schema.Types.Int32> extends true ? Types.Int32 :
311-
IfEquals<PathValueType, Types.Int32> extends true ? Types.Int32 :
312-
IfEquals<PathValueType, Schema.Types.BigInt> extends true ? bigint :
313-
IfEquals<PathValueType, BigInt> extends true ? bigint :
314-
PathValueType extends 'bigint' | 'BigInt' | typeof Schema.Types.BigInt | typeof BigInt ? bigint :
315-
PathValueType extends 'uuid' | 'UUID' | typeof Schema.Types.UUID ? Buffer :
316-
IfEquals<PathValueType, Schema.Types.UUID> extends true ? Buffer :
317-
PathValueType extends MapConstructor | 'Map' ? Map<string, ResolvePathType<Options['of']>> :
318-
IfEquals<PathValueType, typeof Schema.Types.Map> extends true ? Map<string, ResolvePathType<Options['of']>> :
319-
PathValueType extends ArrayConstructor ? any[] :
320-
PathValueType extends typeof Schema.Types.Mixed ? any:
321-
IfEquals<PathValueType, ObjectConstructor> extends true ? any:
322-
IfEquals<PathValueType, {}> extends true ? any:
323-
PathValueType extends typeof SchemaType ? PathValueType['prototype'] :
324-
PathValueType extends Record<string, any> ? ObtainDocumentType<PathValueType, any, { typeKey: TypeKey }> :
325-
unknown,
326-
TypeHint>;
307+
IfEquals<PathValueType, Schema.Types.BigInt> extends true ? bigint :
308+
IfEquals<PathValueType, BigInt> extends true ? bigint :
309+
PathValueType extends 'bigint' | 'BigInt' | typeof Schema.Types.BigInt | typeof BigInt ? bigint :
310+
PathValueType extends 'uuid' | 'UUID' | typeof Schema.Types.UUID ? Buffer :
311+
IfEquals<PathValueType, Schema.Types.UUID> extends true ? Buffer :
312+
PathValueType extends MapConstructor | 'Map' ? Map<string, ResolvePathType<Options['of']>> :
313+
IfEquals<PathValueType, typeof Schema.Types.Map> extends true ? Map<string, ResolvePathType<Options['of']>> :
314+
PathValueType extends ArrayConstructor ? any[] :
315+
PathValueType extends typeof Schema.Types.Mixed ? any:
316+
IfEquals<PathValueType, ObjectConstructor> extends true ? any:
317+
IfEquals<PathValueType, {}> extends true ? any:
318+
PathValueType extends typeof SchemaType ? PathValueType['prototype'] :
319+
PathValueType extends Record<string, any> ? ObtainDocumentType<PathValueType, any, { typeKey: TypeKey }> :
320+
unknown,
321+
TypeHint>;

0 commit comments

Comments
 (0)