From 7c6ff5c49ec9aaaa199e1780ff0eeb6be7a9773e Mon Sep 17 00:00:00 2001 From: Aditi Khare Date: Tue, 12 Nov 2024 16:36:34 -0500 Subject: [PATCH] requested changes 4 --- docs/source/api.js | 1 - types/inferrawdoctype.d.ts | 31 +++++++++++++-------------- types/inferschematype.d.ts | 43 +++++++++++++++++--------------------- 3 files changed, 33 insertions(+), 42 deletions(-) diff --git a/docs/source/api.js b/docs/source/api.js index 62435bfcd22..e398164056a 100644 --- a/docs/source/api.js +++ b/docs/source/api.js @@ -41,7 +41,6 @@ const files = [ 'lib/types/arraySubdocument.js', 'lib/types/buffer.js', 'lib/types/decimal128.js', - 'lib/types/int32.js', 'lib/types/map.js', 'lib/types/array/methods/index.js' ]; diff --git a/types/inferrawdoctype.d.ts b/types/inferrawdoctype.d.ts index da3507f882a..605571057a0 100644 --- a/types/inferrawdoctype.d.ts +++ b/types/inferrawdoctype.d.ts @@ -102,21 +102,18 @@ declare module 'mongoose' { PathValueType extends 'decimal128' | 'Decimal128' | typeof Schema.Types.Decimal128 ? Types.Decimal128 : IfEquals extends true ? Types.Decimal128 : IfEquals extends true ? Types.Decimal128 : - PathValueType extends 'int32' | 'Int32' | typeof Schema.Types.Int32 ? Types.Int32 : - IfEquals extends true ? Types.Int32 : - IfEquals extends true ? Types.Int32 : - IfEquals extends true ? bigint : - IfEquals extends true ? bigint : - PathValueType extends 'bigint' | 'BigInt' | typeof Schema.Types.BigInt | typeof BigInt ? bigint : - PathValueType extends 'uuid' | 'UUID' | typeof Schema.Types.UUID ? Buffer : - IfEquals extends true ? Buffer : - PathValueType extends MapConstructor | 'Map' ? Map> : - IfEquals extends true ? Map> : - PathValueType extends ArrayConstructor ? any[] : - PathValueType extends typeof Schema.Types.Mixed ? any: - IfEquals extends true ? any: - IfEquals extends true ? any: - PathValueType extends typeof SchemaType ? PathValueType['prototype'] : - PathValueType extends Record ? ObtainDocumentType : - unknown; + IfEquals extends true ? bigint : + IfEquals extends true ? bigint : + PathValueType extends 'bigint' | 'BigInt' | typeof Schema.Types.BigInt | typeof BigInt ? bigint : + PathValueType extends 'uuid' | 'UUID' | typeof Schema.Types.UUID ? Buffer : + IfEquals extends true ? Buffer : + PathValueType extends MapConstructor | 'Map' ? Map> : + IfEquals extends true ? Map> : + PathValueType extends ArrayConstructor ? any[] : + PathValueType extends typeof Schema.Types.Mixed ? any: + IfEquals extends true ? any: + IfEquals extends true ? any: + PathValueType extends typeof SchemaType ? PathValueType['prototype'] : + PathValueType extends Record ? ObtainDocumentType : + unknown; } diff --git a/types/inferschematype.d.ts b/types/inferschematype.d.ts index 45c5b9b564a..85d61a45fea 100644 --- a/types/inferschematype.d.ts +++ b/types/inferschematype.d.ts @@ -235,15 +235,13 @@ type IsSchemaTypeFromBuiltinClass = T extends (typeof String) ? true : T extends Types.Decimal128 ? true - : T extends Types.Int32 + : T extends Buffer ? true - : T extends Buffer + : T extends NativeDate ? true - : T extends NativeDate + : T extends (typeof Schema.Types.Mixed) ? true - : T extends (typeof Schema.Types.Mixed) - ? true - : IfEquals; + : IfEquals; /** * @summary Resolve path type by returning the corresponding type. @@ -306,21 +304,18 @@ type ResolvePathType extends true ? Types.Decimal128 : IfEquals extends true ? Types.Decimal128 : - PathValueType extends 'int32' | 'Int32' | typeof Schema.Types.Int32 ? Types.Int32 : - IfEquals extends true ? Types.Int32 : - IfEquals extends true ? Types.Int32 : - IfEquals extends true ? bigint : - IfEquals extends true ? bigint : - PathValueType extends 'bigint' | 'BigInt' | typeof Schema.Types.BigInt | typeof BigInt ? bigint : - PathValueType extends 'uuid' | 'UUID' | typeof Schema.Types.UUID ? Buffer : - IfEquals extends true ? Buffer : - PathValueType extends MapConstructor | 'Map' ? Map> : - IfEquals extends true ? Map> : - PathValueType extends ArrayConstructor ? any[] : - PathValueType extends typeof Schema.Types.Mixed ? any: - IfEquals extends true ? any: - IfEquals extends true ? any: - PathValueType extends typeof SchemaType ? PathValueType['prototype'] : - PathValueType extends Record ? ObtainDocumentType : - unknown, - TypeHint>; + IfEquals extends true ? bigint : + IfEquals extends true ? bigint : + PathValueType extends 'bigint' | 'BigInt' | typeof Schema.Types.BigInt | typeof BigInt ? bigint : + PathValueType extends 'uuid' | 'UUID' | typeof Schema.Types.UUID ? Buffer : + IfEquals extends true ? Buffer : + PathValueType extends MapConstructor | 'Map' ? Map> : + IfEquals extends true ? Map> : + PathValueType extends ArrayConstructor ? any[] : + PathValueType extends typeof Schema.Types.Mixed ? any: + IfEquals extends true ? any: + IfEquals extends true ? any: + PathValueType extends typeof SchemaType ? PathValueType['prototype'] : + PathValueType extends Record ? ObtainDocumentType : + unknown, + TypeHint>;