Figma Support Forum

Getting typescript error on node.fillStyleId

I’m trying to get the style name of the currently selected node.
This is my ts code :

figma.showUI(__html__)

figma.ui.onmessage = msg => {
	if (msg.type === 'show') {
		for (const node of figma.currentPage.selection) {
			console.log(node.fillStyleId)
		}
	}

	figma.closePlugin()
}

and this is the error I’m getting :

code.ts:6:21 - error TS2339: Property 'fillStyleId' does not exist on type 'SceneNode'.
  Property 'fillStyleId' does not exist on type 'SliceNode'.

For me this doesn’t make any sense because I’m able to use node.fillStyleId in code.js file directly.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.