diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..01c5d76 --- /dev/null +++ b/index.d.ts @@ -0,0 +1,5 @@ +declare module "mongoose-lean-virtuals" { + import mongoose = require('mongoose'); + export default function mongooseLeanVirtuals(schema: mongoose.Schema, opts?: any): void; + export function mongooseLeanVirtuals(schema: mongoose.Schema, opts?: any): void; + } \ No newline at end of file diff --git a/index.js b/index.js index 6711edf..3e691c6 100644 --- a/index.js +++ b/index.js @@ -213,4 +213,7 @@ function attachVirtualsToDoc(schema, doc, virtuals) { function isPopulateVirtual(virtualType) { return virtualType.options && (virtualType.options.ref || virtualType.options.refPath); -} \ No newline at end of file +} + +module.exports.defaults = module.exports; +module.exports.mongooseLeanVirtuals = module.exports; \ No newline at end of file diff --git a/test/test.ts b/test/test.ts new file mode 100644 index 0000000..6c54f4d --- /dev/null +++ b/test/test.ts @@ -0,0 +1,17 @@ +import * as mongoose from 'mongoose'; +import * as mongooseLeanVirtuals from "mongoose-lean-virtuals"; + +interface Test { + name: string +} +/* +const testSchema = new mongoose.Schema({ + name: String +}); +*/ + +const testSchema = new mongoose.Schema({ + name: String +}); + +testSchema.plugin(mongooseLeanVirtuals.mongooseLeanVirtuals); \ No newline at end of file