title: Issue constructing a tree using a tree
body: <p>So I have this method which basically traverses through a tree and constructs another tree, basically a map method but for an array, but im facing issue that instead of constructing a tree properly all nodes except the first level are duplicated. Can anyone point out what im doing wrong here?</p>
  
  <pre><code> convertToTree(arcm: any, tree: any) {
      let a = {
        text: arcm.name,
      };
  
      Object.assign(tree, a);
      if (arcm.parcmTreeMapping &amp;&amp; arcm.parcmTreeMapping.length) {
        let arr = new Array&lt;any&gt;(arcm.parcmTreeMapping.length).fill(new Object());
        tree['children'] = arr;
        arcm.parcmTreeMapping.forEach((item, index) =&gt; {
  
          this.convertToTree(item, tree.children[index], descList)
        });
      }
      else{
        return;
      }
    }
  </code></pre>