title: classes and interfaces to write typed Models and schemas of Mongoose in Typescript using definitelytyped
body: <p>how can I use classes and interfaces to write typed Models and schemas in Typescript using definitelytyped .</p>
  
  <pre><code>import mongoose = require("mongoose");
  
   //how can I use a class for the schema and model so I can new up
  export interface IUser extends mongoose.Document {
  name: String;
  }
  
  export class UserSchema{
  name: String;
  }
  
  
  
  
  var userSchema = new mongoose.Schema({
  name: String
  });
  export var User = mongoose.model&lt;IUser&gt;('user', userSchema);
  </code></pre>