title: Typescript types for two objects that combine to form an object type?
body: <p>E.g.:</p>
  <pre><code>type Obj = {
    a: number,
    b: number,
    c: number,
  }
  
  function outer&lt;T extends Partial&lt;Obj&gt;&gt;(obj1: T) {
    return function inner(obj2: Omit&lt;Obj, keyof T&gt;) {
      const obj: Obj = { ...obj1, ...obj2 };
      console.log(obj);
    }
  }
  </code></pre>
  <p>TS Playground: <a href="https://www.typescriptlang.org/play?#code/C4TwDgpgBA8gRgKygXigbwFBSgQwFxQB2ArgLZwQBOANFlHASeVbdgMaNkU0YC+GGAGbFCbYAEsA9oSiTiwKgB4AKlAgAPBYQAmAZygAFHJQk4ANovgIAfNYAUkxAEYCygJTo6lCMGKUZwqIS0lDihIRUDogATAQwpOLAlojUUADWECCSglDK1h6Y2OzSusCyiHGIKOhQAHT1jghOqfW1jdFQvADcdMWEupJmELVmkgDmUQhuPdj8vEA" rel="nofollow noreferrer">https://www.typescriptlang.org/play?#code/C4TwDgpgBA8gRgKygXigbwFBSgQwFxQB2ArgLZwQBOANFlHASeVbdgMaNkU0YC+GGAGbFCbYAEsA9oSiTiwKgB4AKlAgAPBYQAmAZygAFHJQk4ANovgIAfNYAUkxAEYCygJTo6lCMGKUZwqIS0lDihIRUDogATAQwpOLAlojUUADWECCSglDK1h6Y2OzSusCyiHGIKOhQAHT1jghOqfW1jdFQvADcdMWEupJmELVmkgDmUQhuPdj8vEA</a></p>
  <p>I want to ensure that <code>obj1</code> and <code>obj2</code> will combine to match the <code>Obj</code> type. It doesn't matter which of the keys are in <code>obj1</code> and which keys are in <code>obj2</code>. It doesn't matter if some keys overlap, but it'll be nice to avoid overlapping.</p>
  <p>However, the code above doesn't work. I get <code>Type 'number | undefined' is not assignable to type 'number'.</code>. Is it possible to get this working?</p>