diff --git a/index.d.ts b/index.d.ts index 066517b7bcb..9e0ad99ff39 100644 --- a/index.d.ts +++ b/index.d.ts @@ -750,12 +750,13 @@ declare module 'mongoose' { discriminator>(name: string | number, schema: Schema, value?: string | number | ObjectId): U; } + type AnyKeys = Partial<{ [P in keyof T]: T[P] | any }>; interface AnyObject { [k: string]: any } type EnforceDocument = T extends Document ? T : T & Document & TMethods; export const Model: Model; interface Model extends NodeJS.EventEmitter, AcceptsDiscriminator { - new(doc?: T | any): EnforceDocument; + new(doc?: AnyKeys & AnyObject): EnforceDocument; aggregate(pipeline?: any[]): Aggregate>; aggregate(pipeline: any[], cb: Function): Promise>;