title: Typescript mongoose static model method "Property does not exist on type"
body: <p>I am currently trying to add a static method to my mongoose schema but I can't find the reason why it doesn't work this way.</p>
  
  <p>My model:</p>
  
  <pre><code>import * as bcrypt from 'bcryptjs';
  import { Document, Schema, Model, model } from 'mongoose';
  
  import { IUser } from '../interfaces/IUser';
  
  export interface IUserModel extends IUser, Document {
      comparePassword(password: string): boolean;
  }
  
  export const userSchema: Schema = new Schema({
      email: { type: String, index: { unique: true }, required: true },
      name: { type: String, index: { unique: true }, required: true },
      password: { type: String, required: true }
  });
  
  userSchema.method('comparePassword', function (password: string): boolean {
      if (bcrypt.compareSync(password, this.password)) return true;
      return false;
  });
  
  userSchema.static('hashPassword', (password: string): string =&gt; {
      return bcrypt.hashSync(password);
  });
  
  export const User: Model&lt;IUserModel&gt; = model&lt;IUserModel&gt;('User', userSchema);
  
  export default User;
  </code></pre>
  
  <p>IUser:</p>
  
  <pre><code>export interface IUser {
      email: string;
      name: string;
      password: string;
  }
  </code></pre>
  
  <p>If I now try to call <code>User.hashPassword(password)</code> I am getting the following error <code>[ts] Property 'hashPassword' does not exist on type 'Model&lt;IUserModel&gt;'.</code></p>
  
  <p>I know that I didn't define the method anywhere but I don't really know where I could put it as I can't just put a static method into an interface.
  I hope you can help my find the error, thanks in advance!</p>