title: TS2536:Type 'keyof T2' cannot be used to index type 'T1'
body: <p>The swagger-api/swagger-codegen generates following code:</p>
  
  <pre><code>private extendObj&lt;T1,T2&gt;(objA: T1, objB: T2) {
      for(let key in objB){
          if(objB.hasOwnProperty(key)){
              objA[key] = objB[key];
          }
      }
      return &lt;T1&amp;T2&gt;objA;
  }
  </code></pre>
  
  <p>which yields the error when compiling:</p>
  
  <p>TS2536:Type 'keyof T2' cannot be used to index type 'T1'</p>
  
  <p>Could somebody please explain why one object's key can't be used to access another's object fiel? Is the key inferred to some special type?</p>
  
  <p>And what would be the correct way to copy object's properties in typescript?</p>