Help me understand the documentation

It’s been several times now, when I try to access some property of some class, I just get some Proxy object. Now I’m stuck with app.activeDocument.layers - docs say it should return a Layers object, but it doesn’t. And that’s not the only case…

How does this work where instead of some proper object we get a Proxy?

P. S. It seems Document.layerTree is now gone completely and the only way I found to get a full tree, is

let layers = bp([{
  _obj: "get",
  _target: [
    {_property: "json"},
    {_ref: "document", _enum: "ordinal", _value: "targetEnum"}
  ],
  layerInfo: true,
}])[0].json

layers = JSON.parse(layers).layers

works fine for me:
image

I personally always just start with an array of IDs (either all or just the selected ones). I think in terms of performance this is the best approach. Every other layer property can then be accessed along the way via the ID.

image

Win10, Ps 23.1, manifest v4, API v2

This post (see OUTSIDE_LOOP_BEFORE log in a screenshot) just made me think proxies can be used only for loop operations or accessing array properties, but not direct access :thinking: But it still does not explain why docs fail to mention it or why it’s not always the case (like in your screenshot, Simon)