Figma Support Forum

Get children of PageNode

Hey, I’m new to this! Trying out to build a Plugin and am a bit confused.

Say that I do something like this:

const test = figma.currentPage.children[0];

Results in:

code.ts:2:18 - error TS2339: Property 'children' does not exist on type 'SceneNode'.
  Property 'children' does not exist on type 'SliceNode'.

2 console.log(test.children)

The code runs just fine within Figma but gives me error in VSCode. Should I ignore this or will it effect my plugin?

Since a SliceNode cannot have children, you may need to add a condition on which types of nodes to search for children.

1 Like

Ah yeez ofc, didn’t think of that. Thank you this solved it.