title: Typescript: typeof check in list item does not work
body: <p>I have this code in TypeScript:</p>
  
  <pre><code>type NameValue = { name: string; value: string };
  type MixedStuff = NameValue | string;
  
  function stripTwoChars(stuffs: MixedStuff[]): string {
  
      let stuffZero = stuffs[0];
      return (typeof stuffZero === "string" ?
          stuffZero.slice(0, 2) :
          stuffZero.name.slice(0, 2)); // This works fine
  
      return (typeof stuffs[0] === "string" ?
          stuffs[0].slice(0, 2) : // Here error: no slice on NameValue
          stuffs[0].name.slice(0, 2)); // Here error: no name on string
  }
  </code></pre>
  
  <p>So, as you can see in the function, first I save the first list item in a variable and then do a typeof check on that, which works fine.</p>
  
  <p>But if I directly do the typeof on the first list item, the type check does not work.</p>
  
  <p>Is this a bug or why would this supposed to be that way?</p>