title: Dynamic copy only some properties between 2 same typed object in Typescript
body: <p>Hello All I'm getting tsc compilation error when try to merge 2 objects dynamically:
  I try to merge only some properties of the object don't want to copy all of them.
  The example below is a method in a typescript Class that implements the same interface of the parameter received, <strong>&quot;iUser&quot;</strong>,
  so <strong>&quot;this&quot;</strong> is the same type object of the received parameter(<strong>&quot;userSave&quot;</strong>)</p>
  <p>expample:</p>
  <pre><code> updatefromUser(userSave: iUser) {
              let propToValidate: (keyof iUser)[]
              propToValidate = [&quot;Country&quot;, &quot;City&quot;, &quot;State&quot;, &quot;Zip&quot;, &quot;VATnr&quot;, &quot;Language&quot;]
              let updateData: boolean = false;
              propToValidate.forEach(ele =&gt; {
                  if (this[ele] != userSave[ele]) {
                      this[ele] =  userSave[ele]
                      updateData = true
                  }
              });
              return updateData
          }
  </code></pre>
  <p>the compilation error says:</p>
  <p><em>error TS2322: Type 'string | string[] | Date | iAuthUserId[] | iAuthUser[] | null' is not assignable to type 'string &amp; iAuthUserId[] &amp; iAuthUser[] &amp; Date &amp; string[]'.
  Type 'null' is not assignable to type 'string &amp; iAuthUserId[] &amp; iAuthUser[] &amp; Date &amp; string[]'.
  Type 'null' is not assignable to type 'string'.
  112                 this[ele] = userSave[ele]
  ~~~~~~~~~</em></p>
  <p>Anyone knows how to do this dynamically?</p>