title: Flatten object type with array property in typescript react for output to react-data-grid
body: <p>Apologies in advance if this has already been answered, but I am struggling to find an answer to it...
  I have an array which contains a 2 d array property.</p>
  <p>What I want returned is a type which contains has the inner array as a flat object.</p>
  <p>So for example my array could be</p>
  <pre><code>{
    name: &quot;Widget&quot;,
    event: &quot;Xmas&quot;,
    pilot: &quot;Dave&quot;,
    session: &quot;drinking&quot;,
    frameType: &quot;flight&quot;,
    stint: 2016,
   plane: &quot;737&quot;,
   **data: {
     &quot;114&quot;: &quot;137.623&quot;,
     &quot;115&quot;: &quot;51.090&quot;,
  }**
  </code></pre>
  <p>}</p>
  <p>What I would like is my output to be</p>
  <pre><code>{      
  name: &quot;Widget&quot;,
        event: &quot;Xmas&quot;,
        pilot: &quot;Dave&quot;,
        session: &quot;drinking&quot;,
        frameType: &quot;flight&quot;,
        stint: 2016,
       plane: &quot;737&quot;,    
       &quot;114&quot;: &quot;137.623&quot;,
       &quot;115&quot;: &quot;51.090&quot;,    
  ,
  }
  </code></pre>
  <p>Now here is my code to generate the array.</p>
  <p>The Type:</p>
  <pre><code>type TableItem =
      {
          name: string,
          event: string,
          session: string,
          frameType: string,
          stint: number,
          chassis: string,
          driver: string,
          data: (string | number)[][]
      };
  
  
  
  const getTableItem = (index: number) =&gt;
      {
          const d = data[index];
          //Transformentry just makes the id 3 digits
          const dataItems = Object.assign({}, ...Object.entries(d.data).map(transformEntry));        
          
  
  
          const tableItem: TableItem = {
              name: d.name,
              event: d.event,
              piolt: d.pilot,
              session: d.session,
              frameType: d.frameType,
              stint: d.stint,
              plane: d.plane,
              data: dataItems
          };      
          return tableItem;  
      };   
  
   const rows = (data.map((d, index) =&gt; { return getTableItem(index); }));
  </code></pre>
  <p>Now what I want is the rows variable(const) to contain the flattened array.  I have tried flat/flatmap and reduce but can't get them to work.</p>
  <p>If anyone can point me in the right direction with this it would be massively appreciated.  Basically the rows const will then be passed to the react-data-grid component.</p>
  <p>Thanks in advance</p>
  <p>Steve</p>