diff --git a/mongoose/mongoose.d.ts b/mongoose/mongoose.d.ts index 24664cc350..9e5600e696 100644 --- a/mongoose/mongoose.d.ts +++ b/mongoose/mongoose.d.ts @@ -715,7 +715,7 @@ declare module "mongoose" { * section document.js * http://mongoosejs.com/docs/api.html#document-js */ - class MongooseDocument { + class MongooseDocument implements MongooseDocumentOptionals { /** Checks if a path is set to its default. */ $isDefault(path?: string): boolean; @@ -870,8 +870,6 @@ declare module "mongoose" { /** Hash containing current validation errors. */ errors: Object; - /** The string version of this documents _id. */ - id: string; /** This documents _id. */ _id: any; /** Boolean flag specifying if the document is new. */ @@ -880,6 +878,11 @@ declare module "mongoose" { schema: Schema; } + interface MongooseDocumentOptionals { + /** The string version of this documents _id. */ + id?: string; + } + interface DocumentToObjectOptions { /** apply all getters (path and virtual getters) */ getters?: boolean;