diff --git a/test/types/schema.test.ts b/test/types/schema.test.ts index 04bd64a72a3..45dd2653c31 100644 --- a/test/types/schema.test.ts +++ b/test/types/schema.test.ts @@ -1177,3 +1177,9 @@ function gh13702() { const schema = new Schema({ name: String }); expectType<[IndexDefinition, IndexOptions][]>(schema.indexes()); } + +function gh13780() { + const schema = new Schema({ num: Schema.Types.BigInt }); + type InferredType = InferSchemaType; + expectType(null as unknown as InferredType['num']); +} diff --git a/types/inferschematype.d.ts b/types/inferschematype.d.ts index 260d6935956..75240ed1675 100644 --- a/types/inferschematype.d.ts +++ b/types/inferschematype.d.ts @@ -215,14 +215,16 @@ type ResolvePathType extends true ? Types.Decimal128 : IfEquals extends true ? Types.Decimal128 : - PathValueType extends 'uuid' | 'UUID' | typeof Schema.Types.UUID ? Buffer : - IfEquals extends true ? Buffer : - PathValueType extends MapConstructor ? 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 : + PathValueType extends 'bigint' | 'BigInt' | typeof Schema.Types.BigInt ? bigint : + PathValueType extends 'uuid' | 'UUID' | typeof Schema.Types.UUID ? Buffer : + IfEquals extends true ? Buffer : + PathValueType extends MapConstructor ? 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;