typescript - Header files for Mongoose' 'plugin' method (extending via .methods and .statics) -
i'm trying create typescript header files script extends mongoose-model using .plugin method. current signature mongoose header-files : export class schema { // ... plugin(plugin: (schema: schema, options?: object) => void, options?: object): schema; // ... } some actual code mongoose-lib : /** * registers plugin schema. * * @param {function} plugin callback * @param {object} [opts] * @see plugins * @api public */ schema.prototype.plugin = function (fn, opts) { fn(this, opts); return this; }; then own model, extending plugin ; import passportlocalmongoose = require('passport-local-mongoose') // ... var userschema = new mongoose.schema({ email: string, password: string, }); // ... userschema.plugin(passportlocalmongoose, { usernamefield: "email", usernamelowercase: true }); snippet passport-local-mongoose source: module.exports = function(schema, options) { // ... schema.method...