Hi!
A lot of my code (usually typed into the Scripter plugin) walks though what’s selected on a page, and if a selected node has children, I also want to look inside of that node to find what I’m looking for.
What is the best way to determine, code-wise, whether a node can contain children? Here is the method I use, which seems pretty hacky at best:
const selectedNodes = figma.currentPage.selection as any[];
for (const selectedNode of selectedNodes){
// find out if selectedNode can contain children
if ('|FRAME|GROUP|SECTION|COMPONENT|COMPONENT_SET|INSTANCE|'.includes(`|${selectedNode.type}|`)){
selectedNode.findAll(...)
Is there a better way?