title: Make a single property optional in TypeScript
body: <p>In TypeScript, 2.2...</p>
  
  <p>Let's say I have a Person type:</p>
  
  <pre><code>interface Person {
    name: string;
    hometown: string;
    nickname: string;
  }
  </code></pre>
  
  <p>And I'd like to create a function that returns a Person, but doesn't require a nickname:</p>
  
  <pre><code>function makePerson(input: ???): Person {
    return {...input, nickname: input.nickname || input.name};
  }
  </code></pre>
  
  <p>What should be the type of <code>input</code>? I'm looking for a dynamic way to specify a type that is identical to <code>Person</code> except that <code>nickname</code> is optional (<code>nickname?: string | undefined</code>). The closest thing I've figured out so far is this:</p>
  
  <pre><code>type MakePersonInput = Partial&lt;Person&gt; &amp; {
    name: string;
    hometown: string;
  }
  </code></pre>
  
  <p>but that's not quite what I'm looking for, since I have to specify all the types that are <em>required</em> instead of the ones that are optional.</p>