title: Copy a object properties to another in TypeScript, cause error TS2339
body: <p>I use a <code>extend()</code> function to extend a object:
  </p>
  
  <pre><code>function extend(obj: Object, extension: Object) {
      for (var key in obj) {
          try {
              extension[key] = obj[key];
          } catch (e) {
              console.error(e);
          }
      }
  }
  </code></pre>
  
  <p>And there is a class <code>Observer()</code> hava a method <code>Update()</code> and a object <code>check</code> which is <code>HTMLInputElement</code> type.
  </p>
  
  <pre><code>class Observer {
      Update(value) { }
  }
  var check:HTMLInputElement = document.createElement("input");
  </code></pre>
  
  <p>I use <code>extend()</code> function to extend <code>checkbox</code>,so it would have the method <code>Update()</code>.
  </p>
  
  <pre><code>extend(new Observer(), check);
  check.Update = function(value) {
      this.checked = value;
  }
  </code></pre>
  
  <p>And then cause error TS2339:<code>Property 'Update' does not exist on type 'HTMLInputElement'</code>
  <a href="https://i.stack.imgur.com/w2aSC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/w2aSC.png" alt="enter image description here"></a></p>
  
  <p>How to Fixed this error? Change the <code>extend()</code> function?</p>