title: Type narrowing of "one level deep" discriminated union in Typescript
body: <p>I'm not able to get the following to typecheck:</p>
  <pre><code>type Apple = {
    variety: {type: 'fuji'} | {type: 'gala'}
  }
  
  type FujiApple = {
    [P in keyof Apple]: P extends 'variety'
      ? Extract&lt;Apple['variety'], {type: 'fuji'}&gt;
      : Apple[P]
  }
  
  function fujiFn(fugi: FujiApple) {}
  
  function appleFn(apple: Apple) {
    if (apple.variety.type === 'fuji') {
  
      // FAILS: Argument of type 'Apple' is not assignable to parameter of type
      // 'FujiApple'
      fujiFn(apple)
    }
  }
  </code></pre>
  <p>Is there a way to type this to get the narrowing to work as intended? This happens only when the discriminator is not at the top level.</p>
  <p><strong>Solution I don't Like:</strong></p>
  <p>The following actually works, but it's... ugly and I would rather not do this.</p>
  <pre><code>fujiFn({...apple, variety:apple.variety})
  </code></pre>