Await app.activeDocument.activeLayers.merge()

activeLayers never had a merge method. Layer has one. Not a solution, but this might give you some insight:

1 Like