title: TypeScript Error: Object literal may only specify known properties, and '...' does not exist in type 'DeepPartial<Document>'
body: <p>I'm trying to create a simple controller API in NodeJS using TypeScript, but I'm getting error <code>ts(2345)</code> when I'm assigning values to the model.</p>
  
  <p>Here is my <strong>user model</strong>:</p>
  
  <pre><code>import mongoose, {Schema} from 'mongoose'
  
  const userSchema: Schema = new Schema({
      _id: Schema.Types.ObjectId,
      login: {
          type: String,
          unique: true,
          required: true
      },
      email: {
          type: String,
          unique: true,
          match: (value: string) =&gt; /\S+@\S+\.\S+/.test(value),
          required: true
      },
      password: {
          type: String,
          required: true
      },
      createdAt: {
          type: Date,
          default: Date.now
      }
  })
  
  export default mongoose.model('User', userSchema)
  </code></pre>
  
  <p>And <strong>controller</strong>: </p>
  
  <pre><code>import User from '../models/User'
  import {Request, Response} from 'express'
  
  export class UserController {
  
      public addNewUser (req: Request, res: Response) {
          const {login, email, password} = req.body
  
                  // some code
  
          const newUser = new User({
              // ts error:
              // Argument of type '{ login: any; email: any; 
              // password: any; date: number; }' is not assignable 
              // to parameter of type 'DeepPartial&lt;Document&gt;'.
              // Object literal may only specify known properties, 
              // and 'login' does not exist in type 
              // 'DeepPartial&lt;Document&gt;'.ts(2345)
              login,
              email,
              password,
              date: Date.now()
          })
      }
  }
  </code></pre>
  
  <p>I've found a solution to get off this error: </p>
  
  <pre><code>const newUser = new User({          
              login,
              email,
              password,
              createdAt: Date.now(),
              ...req.body
          })
  </code></pre>
  
  <p>But I'm not sure this is a good approach and still don't know why i'm getting this ts error at all. Any help?</p>