title: Flatten an array with children using Lodash and TypeScript
body: <p>Using TypeScript code, I'm trying to flatten an array of objects where each element can contain children:</p>
  <pre><code>function getMenu (menus:Array&lt;Menu&gt;, name:string | undefined) {
    console.log('getMenu', name, menus[0])
    const test = _(menus)
      .thru(function (coll) {
        return _.union(coll, _.map(coll, 'children') || [])
      })
    console.log('getMenu 2', test)
    return name
  }
  </code></pre>
  <p>I have this error that is blocking me:</p>
  <blockquote>
  <p>argument of type 'Menu[][]' is not assignable to parameter of type 'List'.</p>
  <p>Index signatures are incompatible.</p>
  <p>Type 'Menu[]' is missing the following properties from type 'Menu': label, icon, route, selectable, and 2 more.</p>
  </blockquote>
  <p>NB: The code works well in JavaScript.</p>