title: Mongoose typing issue with typescript
body: <p>I am building an app using mongoose and typescript. Here is a simple model I have made: </p>
  
  <pre><code>import * as callbackMongoose from 'mongoose';
  var mongoose = callbackMongoose;
  mongoose.Promise = global.Promise;
  const Schema = mongoose.Schema;
  
  var userSchema = new Schema({
      username: String,
      email: String,
      hash: String
  });
  
  export default mongoose.model('User', userSchema);
  </code></pre>
  
  <p>It works well but I need to cast each document to any before accessing properties. I read a guide that said I could do this: </p>
  
  <pre><code>interface IUser extends mongoose.Document {
    username: String;
    email: String;
    hash: String;
  }
  
  export default mongoose.model&lt;IUser&gt;('User', userSchema);
  </code></pre>
  
  <p>My problem is that the type mongoose doesn't seem to have the property <code>Document</code>. It also doesn't have the property <code>ObjectId</code>. When I cast mongoose to any and use these members it works just fine. It seems to be a typing issue. </p>
  
  <p>I installed the mongoose typing like so:</p>
  
  <pre><code>npm install @types/mongoose --save
  </code></pre>
  
  <p>The typings do work for Schema and they are good for all of the other libraries I use. Is something wrong with these type definitions? Am I doing something wrong?</p>