title: How to use nested object/array notation in node-fetch headers?
body: <p>I am trying to make a <strong>fetch()</strong> api call from typescript application based on below specification:</p>
  
  <blockquote>
    <ul>
    <li>Method: POST</li>
    <li>Request URL: <a href="https://cloud.memsource.com/web/api2/v1/projects/KmtNyVlz1skQd2aMVEipp7/jobs?token=AuthenticationToken" rel="nofollow noreferrer">https://cloud.memsource.com/web/api2/v1/projects/KmtNyVlz1skQd2aMVEipp7/jobs?token=AuthenticationToken</a></li>
    <li>(Header) Content-Disposition: filename*=UTF-8''file.txt</li>
    <li>(Header) Memsource: {"targetLangs":["de","fr"]}</li>
    <li>(Header) Content-Type: application/octet-stream</li>
    <li>Response: Job UID (e.g. dOYgeXzAdAbj4xFjuEVZP2)</li>
    </ul>
  </blockquote>
  
  <p>I am getting following error when trying to use nested object/array value for headers in node-fetch call.</p>
  
  <blockquote>
    <p>(property) RequestInit.headers?: HeadersInit Type '{ 'Content-Type':
    string; 'Content-Disposition': string; 'Memsource': { 'targetLangs':
    string[]; }; }' is not assignable to type 'HeadersInit'.   Type '{
    'Content-Type': string; 'Content-Disposition': string; 'Memsource': {
    'targetLangs': string[]; }; }' is missing the following properties
    from type 'Headers': forEach, append, delete, get, and 7 more.ts(2322)
    index.d.ts(45, 5): The expected type comes from property 'headers'
    which is declared here on type 'RequestInit'</p>
  </blockquote>
  
  <p>Below is the line of the code giving the problem.</p>
  
  <pre><code>let project: Promise&lt;Response&gt; = await fetch(apiURL, {
      method: 'POST',
      headers: {
        'Content-Disposition': 'd:/_export/en_US.json',
        'Memsource': { 'targetLangs': ['fr_fr', 'es_es'] },
      },
    }).then(res =&gt; res.json())
      .then(json =&gt; json)
      .catch(err =&gt; console.log(err));
  </code></pre>
  
  <p>What should I do to fix the problem?  Am I not allowed to use this notation?</p>