Skip to content

Commit

Permalink
Merge pull request #9789 from mroohian/bugfix/rr/schema-defenition-ac…
Browse files Browse the repository at this point in the history
…cept-model

Fix the schema to accept typed SchemaDefinition
  • Loading branch information
vkarpov15 authored Feb 1, 2021
2 parents 3439515 + 7acaa73 commit 37b635e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1045,14 +1045,14 @@ declare module 'mongoose' {
type SchemaPreOptions = { document?: boolean, query?: boolean };
type SchemaPostOptions = { document?: boolean, query?: boolean };

class Schema<DocType extends Document = Document, M extends Model<DocType> = Model<DocType>> extends events.EventEmitter {
class Schema<DocType extends Document = Document, M extends Model<DocType> = Model<DocType>, SchemaDefModel = undefined> extends events.EventEmitter {
/**
* Create a new schema
*/
constructor(definition?: SchemaDefinition, options?: SchemaOptions);
constructor(definition?: SchemaDefinition<SchemaDefModel>, options?: SchemaOptions);

/** Adds key path / schema type pairs to this schema. */
add(obj: SchemaDefinition | Schema, prefix?: string): this;
add(obj: SchemaDefinition<SchemaDefModel> | Schema, prefix?: string): this;

/**
* Array of child schemas (from document arrays and single nested subdocs)
Expand Down

0 comments on commit 37b635e

Please sign in to comment.