Type 'Partial<CustomTreeviewItem>' is missing the following properties from type 'CustomTreeviewItem

157 Views Asked by At

I am getting this error that Partial Custom TreeviewItem is missing following properties. The problem is that CustomTreeviewItem is Extended with Treeviewitem class which is the part of 3rd party Library.

enter image description here

enter image description here

Now the code which pushes in the array is asking for derived class properties as well.

public static FlattenTreeArray(result: CustomTreeviewItem[], list: CustomTreeviewItem[]): any[] {
    _.each(list, function (item) {
      result.push(_.omit(item, 'internalChildren'));
      if (item['internalChildren'] && item['internalChildren'].length) {
        OnixModuleHelper.FlattenTreeArray(result, item['internalChildren']);
      }
    });

    return result;
  }

enter image description here

I would be glad if got idea what can be done to prevent this.

0

There are 0 best solutions below