title: Confusion of WebStorm type recognition of function return types
body: <p>Using the following code:</p>
  
  <pre><code>/**
   * @typedef {foo} MyFoo
   * @property {String} fooText
   * @property {Number} fooValue
   */
  
  /**
   * @type {MyFoo}
   */
  var foo = {
    fooText : '',
    fooValue : 0
  };
  
  /**
   * @param {MyFoo} someFoo
   * @returns {MyFoo}
   */
  function doStuff(someFoo)
  {
    var result = Object.create(foo);
  
    result.fooText = someFoo.fooText + '!';
    result.fooValue = someFoo.fooValue + 1;
  
    return result; 
  }
  
  
  var someFoo = Object.create(foo);
  someFoo.fooText = 'Hello';
  someFoo.fooValue = 3;
  
  var someOtherFoo = doStuff(someFoo);
  var anotherFoo = doStuff(someOtherFoo);
  </code></pre>
  
  <p>I create a type <code>MyFoo</code>. I use this type as both the parameter and the return value of the function <code>doStuff</code>. Then, I repeatedly call the <code>doStuff</code> function, first with an object created with <code>Object.create</code>, then with the return value of the previous call.</p>
  
  <p>Here is the issue:
  <img src="https://i.stack.imgur.com/PkgeL.png" alt="Argument type MyFoo is not assignable to parameter type MyFoo"></p>
  
  <p><strong>Argument type MyFoo is not assignable to parameter type MyFoo</strong></p>
  
  <p>Plus, <code>someOtherFoo</code> and <code>anotherFoo</code> are not auto-completed with the MyFoo properties anymore.</p>
  
  <p>What's happening?</p>