From 94cd38172a762a6ac9a55a3abe34ea3222e0717d Mon Sep 17 00:00:00 2001 From: mohammad0-0ahmad Date: Thu, 7 Jul 2022 15:54:56 +0200 Subject: [PATCH] Delete InferDocumentType helper --- test/types/virtuals.test.ts | 6 +++--- types/inferschematype.d.ts | 12 ------------ 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/test/types/virtuals.test.ts b/test/types/virtuals.test.ts index 70a214004e7..dc55523c414 100644 --- a/test/types/virtuals.test.ts +++ b/test/types/virtuals.test.ts @@ -1,4 +1,4 @@ -import { Document, Model, Schema, model, InferSchemaType, InferDocumentType, FlatRecord } from 'mongoose'; +import { Document, Model, Schema, model, InferSchemaType, FlatRecord, ObtainSchemaGeneric } from 'mongoose'; import { expectType } from 'tsd'; interface IPerson { @@ -90,7 +90,7 @@ function gh11543() { function autoTypedVirtuals() { type AutoTypedSchemaType = InferSchemaType; type VirtualsType = { domain: string }; - type InferredDocType = InferDocumentType; + type InferredDocType = FlatRecord>; const testSchema = new Schema({ email: { @@ -118,5 +118,5 @@ function autoTypedVirtuals() { const doc = new TestModel(); expectType(doc.domain); - expectType>({} as InferredDocType); + expectType>({} as InferredDocType); } \ No newline at end of file diff --git a/types/inferschematype.d.ts b/types/inferschematype.d.ts index 20f1772665c..5041f830477 100644 --- a/types/inferschematype.d.ts +++ b/types/inferschematype.d.ts @@ -40,18 +40,6 @@ declare module 'mongoose' { */ type InferSchemaType = ObtainSchemaGeneric; - /** - * @summary Obtains document plain doc type from Schema instance. - * @description Exactly like {@link InferSchemaType}, but it add virtual paths. - * @param {SchemaType} SchemaType A generic of schema type instance. - * @example - * const userSchema = new Schema({userName:String}); - * type UserType = InferDocumentType; - * // result - * type UserType = {userName?: string} - */ - type InferDocumentType = FlatRecord & ObtainSchemaGeneric>; - /** * @summary Obtains schema Generic type by using generic alias. * @param {TSchema} TSchema A generic of schema type instance.