title: TypeScript Conditional Type complains Type not assignable
body: <p>I am trying to understand how TypeScript conditional type works.  Here is my code.  There are type errors:</p>
  
  <pre><code>interface MyType {
    name: string;
  }
  
  const testFunc = &lt;T extends MyType | string&gt;(
    what: T
  ): T extends MyType ? MyType : string =&gt; {
    if (typeof what === 'object') {
      return what['name'];
    }
    return what;
  };
  </code></pre>
  
  <p>What is the correct usage?</p>
  
  <p><a href="https://i.stack.imgur.com/dyHph.png" rel="noreferrer"><img src="https://i.stack.imgur.com/dyHph.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/qEzUO.png" rel="noreferrer"><img src="https://i.stack.imgur.com/qEzUO.png" alt="enter image description here"></a></p>