Skip to content

Commit

Permalink
Merge pull request #10452 from DouglasGabr/master
Browse files Browse the repository at this point in the history
fix(types): remove discriminator type requirement
  • Loading branch information
vkarpov15 committed Jul 16, 2021
2 parents 5edb25d + 982a389 commit ed1bffb
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -618,8 +618,8 @@ declare module 'mongoose' {

interface AcceptsDiscriminator {
/** Adds a discriminator type. */
discriminator<D extends Document>(name: string | number, schema: Schema<D>, value?: string | number | ObjectId): Model<D>;
discriminator<T extends Document, U extends Model<T>>(name: string | number, schema: Schema<T, U>, value?: string | number | ObjectId): U;
discriminator<D>(name: string | number, schema: Schema<D>, value?: string | number | ObjectId): Model<D>;
discriminator<T, U extends Model<T>>(name: string | number, schema: Schema<T, U>, value?: string | number | ObjectId): U;
}

interface AnyObject { [k: string]: any }
Expand Down Expand Up @@ -1703,8 +1703,8 @@ declare module 'mongoose' {

static options: { castNonArrays: boolean; };

discriminator<D extends Document>(name: string | number, schema: Schema<D>, value?: string): Model<D>;
discriminator<T extends Document, U extends Model<T>>(name: string | number, schema: Schema<T, U>, value?: string): U;
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;

/**
* Adds an enum validator if this is an array of strings or numbers. Equivalent to
Expand Down Expand Up @@ -1760,8 +1760,8 @@ declare module 'mongoose' {

static options: { castNonArrays: boolean; };

discriminator<D extends Document>(name: string | number, schema: Schema<D>, value?: string): Model<D>;
discriminator<T extends Document, U extends Model<T>>(name: string | number, schema: Schema<T, U>, value?: string): U;
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;

/** The schema used for documents in this array */
schema: Schema;
Expand Down

0 comments on commit ed1bffb

Please sign in to comment.