Skip to content

Commit

Permalink
fix(index.d.ts): add discriminator() for single nested subdocs to t…
Browse files Browse the repository at this point in the history
…ype definitions

Re: #10435
  • Loading branch information
vkarpov15 committed Jul 16, 2021
1 parent ed1bffb commit 34d2796
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion index.d.ts
Expand Up @@ -1799,12 +1799,15 @@ declare module 'mongoose' {
auto(turnOn: boolean): this;
}

class Embedded extends SchemaType {
class Embedded extends SchemaType implements AcceptsDiscriminator {
/** This schema type's name, to defend against minifiers that mangle function names. */
static schemaName: string;

/** The document's schema */
schema: Schema;

discriminator<D>(name: string | number, schema: Schema<D>, value?: string): Model<D>;
discriminator<T, U extends Model<T>>(name: string | number, schema: Schema<T, U>, value?: string): U;
}

class String extends SchemaType {
Expand Down

0 comments on commit 34d2796

Please sign in to comment.