Hi,
I’ve found a discrepancy in the way Layers vs Channels collections work.
const ps = require('photoshop');
const doc = ps.app.activeDocument;
const executeAsModal = ps.core.executeAsModal;
let channelDup = await doc.channels[0].duplicate();
console.log(channelDup) // undefined?!
channelDup.name = "DUP" // fails
let layerDup = await doc.layers[0].duplicate();
console.log(layerDup) // Layer
layerDup.name = "DUP" // OK
In the documentation, Layer.duplicate()
returns Promise <[Layer]>, while Channel.duplicate()
returns Promise <[Void]>. Although it actually works as documented, I believe the latter should return Promise <[Channel]> instead—so that we can store a Channel reference in a variable for later use, or chain methods.
Should I log a bug? Thanks!
Davide