The delete () function of the IComments interface (PnP) does not delete the comment I select through the index, how can I use it? (@pnp/sp/comments)
Use the clear method exposed by IComments. The clear method would delete all comments on the item returned.
const item = sp.web.lists.getByTitle('Title').items.getById(1);
await item.comments.clear();
Or you could use the snippet below which will delete the comment with the specified id.
const commentId = 2000;
await item.comments.getById(commentId).delete();