title: Why the error " Cannot set properties of undefined..." appears in Angular 10?
body: <p>I am working on an application where a user can register, for this the user has to write data such as name, nickname, password, type of identification, etc ...</p>
  <p>The model of user:</p>
  <pre><code>export class User{
      id: string;
      name: string;
      nickname: string;
      password: string;
      docType: {
          documentTypeId: number;
      }
  }
  </code></pre>
  <p>The component .ts:</p>
  <pre><code>public insertUser(event: Event): void{
        event.preventDefault();
          
        const u: User = new User();
  
        u.id = this.form.value.id;
        u.name = this.form.value.name;
        u.nickname = this.form.value.nickname;
        u.password = this.form.value.password;
        u.docType.documentTypeId = Number(this.form.value.typeId); // the error occurs here
  
        /*send to API, save to DB... */ 
  }
  </code></pre>
  <p>So, the error occurs when the value of <code>u.docType.documentTypeId</code> is assigned, I don't know what I'm doing wrong.</p>