From 49f5296eb22f10e56c88bce2f435ba75d4d9bb4f Mon Sep 17 00:00:00 2001 From: Zach Levi Date: Sun, 15 Oct 2023 18:08:50 +0300 Subject: [PATCH] Fix Typescript definition of schema.discriminator to allow strings. --- types/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/index.d.ts b/types/index.d.ts index f38324417a9..3f94524ba98 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -260,7 +260,7 @@ declare module 'mongoose' { /** Returns a copy of this schema */ clone(): T; - discriminator(name: string, schema: DisSchema): this; + discriminator(name: string | number, schema: DisSchema): this; /** Returns a new schema that has the picked `paths` from this schema. */ pick(paths: string[], options?: SchemaOptions): T;