From 4741531a9f112b48a95f9f4c35c50ae492971cea Mon Sep 17 00:00:00 2001 From: Mohammad Date: Tue, 19 Jul 2022 04:58:12 +0200 Subject: [PATCH] Delete InferDocumentType helper --- test/types/virtuals.test.ts | 8 ++++---- types/inferschematype.d.ts | 12 ------------ 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/test/types/virtuals.test.ts b/test/types/virtuals.test.ts index 70a214004e7..a5b07f54419 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); -} \ No newline at end of file + expectType>({} as InferredDocType); +} 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.