title: How do I return Record when building it as Partial in function?
body: <p>How do I return <code>Record</code> when building it as <code>Partial</code> in the function bellow?</p>
  
  <pre><code>type mytype = 'a' | 'b' | 'c' | 'd';
  
  function generate(): Record&lt;mytype,any&gt; {
      const p: Partial&lt;Record&lt;mytype, any&gt;&gt; = {};
  
      // some code which dynamically builds up 'p'
  
      return p;
  }
  </code></pre>
  
  <p>The error I am getting is:</p>
  
  <blockquote>
    <p>[ts]
        Type 'Partial>' is not assignable to type 'Record'.
          Property 'a' is optional in type 'Partial>' but required in type 'Record'.</p>
  </blockquote>
  
  <p><strong>UPDATE:</strong>
  I found I can just do the following, but is it the correct way to do it?</p>
  
  <pre><code>return p as Record&lt;mytype, any&gt;;
  </code></pre>