title: How to document a type returned by a function (not constructor), and its methods
body: <p>I'm using <a href="https://github.com/jsdoc3/jsdoc" rel="nofollow">JsDoc3</a> and the <a href="https://developers.google.com/closure/compiler/" rel="nofollow">Closure Compiler</a>. I use a <a href="https://github.com/jsdoc3/jsdoc/tree/master/templates/haruki" rel="nofollow">JsDoc template which outputs JSON</a> for me to make HTML from it with a custom script.</p>
  
  <p>I have a function which returns a custom class (but I don't have, nor need, a constructor), and I want to be able to document it (the function), and the functions present in the returned object.</p>
  
  <pre><code>myLib.defer = function() {
  
      return {
          'then':    function() {},
          'resolve': function() {},
          'reject':  function() {},
          'notify':  function() {},
          'promise': function() {}
      };
  
  };
  </code></pre>
  
  <p><strong>How do I document this?</strong> I don't have a constructor, <strong>nor I need one.</strong> I do not care that much about documenting the "class" (<strong>I don't need one</strong>, and besides, the object returned is documented in the <code>@return</code> of this function), <strong><em>the only thing I need is to document the functions that are present in the returned object</em></strong>, so they end up in the JsDoc's JSON output for me to grab.</p>
  
  <p>Also, I'm using Closure Compiler's <code>AVANCED_OPTIMIZATIONS</code> mode, so if any workaround's side effects (such as useless code) will be supressed by that, it's a good workaround.</p>