Type 'SceneNode' is not assignable to type 'ComponentNode'

I’m creating a variable from a selected component

const selectedComponent: ComponentNode = figma.currentPage.selection[0];

However, I’m hitting the following type error:

Type 'SceneNode' is not assignable to type 'ComponentNode'.

A SceneNode is the union over many node types, including ComponentNode [source]. So, this error seems erroneous.

Perhaps it’s an issue with the current version of @figma/plugin-typings?

2 Likes