How to delete an item by uid dgraph-js

Try this

upsert {
  query {
    v as var(func: has(Post.comments)) 
  }

  mutation {
    set {
      uid(v) <dgraph.type> "Post" .
    }

  }
}

After that you can try to delete the target node.