diff --git a/test/types/schema.test.ts b/test/types/schema.test.ts index 2be451d4b34..b4035ceb651 100644 --- a/test/types/schema.test.ts +++ b/test/types/schema.test.ts @@ -1733,3 +1733,8 @@ async function gh15236() { schema.path('myNum').min(0); } + +function gh15244() { + const schema = new Schema({}); + schema.discriminator('Name', new Schema({}), { value: 'value' }); +} diff --git a/types/index.d.ts b/types/index.d.ts index 9cf63bc396f..a5dbf29c818 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -297,7 +297,7 @@ declare module 'mongoose' { /** Returns a copy of this schema */ clone(): T; - discriminator(name: string | number, schema: DisSchema): this; + discriminator(name: string | number, schema: DisSchema, options?: DiscriminatorOptions): this; /** Returns a new schema that has the picked `paths` from this schema. */ pick(paths: string[], options?: SchemaOptions): T;