title: Mongoose Property 'x' does not exist on type 'Document'
body: <p>The ts compiler says that none of the properties exist on type 'Document'.</p>
  
  <p>It seems that because of this none of the properties on the model can be set.
  If I print a user object to the console all I get is 
  {"_id":"long hex id number"}</p>
  
  <p>My model is configured as follows:</p>
  
  <p>users.ts</p>
  
  <pre><code>import * as mongoose from 'mongoose';
  import * as crypto from 'crypto';
  import * as jwt from 'jsonwebtoken';
  
  var userSchema = new mongoose.Schema({
      email: {
          type: String,
          unique: true,
          required: true
      },
      firstMidname: {
          type: String,
          required: true
      },
      lastName: {
          type: String,
          required: true
      },
      hash: String,
      salt: String
  });
  
  userSchema.methods.setPassword = setPassword;
  
  
  userSchema.methods.validPassword = validPassword;
  
  userSchema.methods.generateJwt = generateJwt;
  
  export = mongoose.model('User', userSchema);
  </code></pre>
  
  <p>Api connection point
  api.ts</p>
  
  <pre><code>import * as express from    'express';
  import * as mongoose from   'mongoose';
  import * as passport from   'passport';
  
  var User = mongoose.model('User');
  
  var router = express.Router();
  
  router.post('/', createUser);
  
  function createUser(req, res){
  var user = new User();
      console.log(user);
      user.firstMidName = req.body.firstName;
      user.lastName = req.body.lastName;
      user.setPassword(req.body.password);
  
      user.save((err) =&gt; {
          console.log("saving user");
          var token;
          token = user.generateJwt();
          res.status(200);
          res.json({
              'token': token
          });
      });
  }
  
  export = router;
  </code></pre>
  
  <p>How can I fix or troubleshoot this issue? Nothing in the <code>user.save</code> block executes.</p>
  
  <p><strong>EDIT:</strong> The two things seem to be unrelated. I can now save to the database however the typescript error persists. Is this expected behaviour?</p>