title: JSDoc: How to document an object with mix of dynamic and fixed properties?
body: <p>Suppose I have a function like so:</p>
  
  <pre><code>function validator(obj){
    const ret = {};
  
    for (const key in obj){
      // Returns a boolean
      result = validate(key, obj[key]);
  
      if (result !== true)
        ret.error = true;
  
      ret[key] = result;
    }
  
    return ret;
  }
  </code></pre>
  
  <p>This function will return an object, the content of the object is dynamically populated depending on the argument passed to the function.</p>
  
  <p>I can document the function like so:</p>
  
  <pre><code>/**
   * @param {Object.&lt;string, *&gt;} obj
   * @returns {Object.&lt;string, boolean&gt;}
   */
  </code></pre>
  
  <p>But it doesn't document the dynamic <code>.error</code> property that will also return a boolean.</p>
  
  <p>If it is all it will return, I can simply write:</p>
  
  <pre><code>/**
   * @param {Object.&lt;string, *&gt;} obj
   * @returns {{error: boolean}}
   */
  </code></pre>
  
  <p>But then it doesn't document the dynamic properties now.</p>
  
  <p>What I can think of doing is something like:</p>
  
  <pre><code>/**
   * @param {Object.&lt;string, *&gt;} obj
   * @returns {Object.&lt;string, boolean&gt;|{error: boolean}}
   */
  </code></pre>
  
  <p>While it works, it doesn't look syntactically correct to me. I can't use <code>@typedef</code> because it should be used when I already know what property will be used.</p>
  
  <p>I can't find anything regarding this issue in the <a href="https://jsdoc.app" rel="noreferrer">JSDoc's documentation</a>.</p>
  
  <p>So how do I document an object with mix of dynamic and fixed properties?</p>