title: Typescript: An interface with optional properties is not assignable to a type with the same but required properties
body: <p>Here is what i wanna do:</p>
  
  <pre class="lang-typescript prettyprint-override"><code>const assign = &lt;T extends U, U&gt;(original: T, changes: U) =&gt;
    &lt;T&gt;Object.assign({}, original, changes);
  
  interface IFoo {
    bar: number,
    baz?: string,
    quux?: boolean,
  }   
  
  let foo = &lt;IFoo&gt;{ bar: 42, baz: 'hello' };
  
  assign(foo, { baz: 'world' }); //Compilation Error:
  </code></pre>
  
  <p>I just wanna implement a type safe <code>assign</code>. but the compiler throws the error: </p>
  
  <blockquote>
    <p>Argument of type 'IFoo' is not assignable to parameter of type '{ baz: string; }'.
      Property 'baz' is optional in type 'IFoo' but required in type '{ baz: string; }'.</p>
  </blockquote>
  
  <p>The properties of <code>changes</code> type should always be a strict subset of <code>original</code> type, this kind of assignment should be totally logical, I think.</p>
  
  <p>How do I get around it, appeasing the scrupulous compiler without sacrificing the type safety of the <code>changes</code> parameter?</p>