title: What to use instead of Object.assign in TypeScript
body: <p>I am using a mapped type in my <a href="/questions/tagged/typescript" class="post-tag" title="show questions tagged &#39;typescript&#39;" rel="tag">typescript</a> source, that I am reusing throughout my project:</p>
  
  <pre><code>type StringUnion = string | string[];
  type StringUnionMap = { [key: string]: StringUnion };
  </code></pre>
  
  <p>I have to combine two of these maps into one map that contains the entries of both:</p>
  
  <pre><code>let map1: StringUnionMap = { "key1": "value1", "key2": "value2" };
  let map2: StringUnionMap = { "key3": [ "value3a", "value3b" ] };
  </code></pre>
  
  <p>I can of course achieve what I want in a loop like this:</p>
  
  <pre><code>let combinedMap: StringUnionMap = {};
  for (let key in map1) {
      combinedMap[key] = map1[name];
  }
  for (let key in map2) {
      combinedMap[key] = map2[name];
  }
  </code></pre>
  
  <p>I find this way a bit clumsy and verbose. Is there any more concise way to combine my two maps?</p>
  
  <p>I have tried this, but that does not <strike>compile</strike> transpile:</p>
  
  <pre><code>let combinedMap: StringUnionMap = new StringUnionMap( [ map1, map2 ] );
  </code></pre>
  
  <p>The respective <a href="https://stackoverflow.com/questions/171251/how-can-i-merge-properties-of-two-javascript-objects-dynamically">JavaScript solution with Object.assign</a> does not work, because I am targeting ES5 with <code>noImplicitAny</code> turned on. Therefore <a href="https://stackoverflow.com/questions/38860161/using-typescript-and-object-assign-gives-me-an-error-property-assign-does-no"><code>Object.assign</code> is not available to me</a>.</p>