Filtern Sie ein Objektarray -Baum JavaScript

const filterData = (data : any, id : any) => data.filter((o : any) => {
  if (o.children) o.children = filterData(o.children, id);
  return o.id != id
})

const searchResult = filterData(tasks, "Task 1")
Daniel Kristoffersen