public/code.js
// FIXME: Typescript says detachInstance() doesn't exist on SceneNode & ChildrenMixin 
Typescript says detachInstance() doesn't exist on SceneNode & ChildrenMixin
Typescript says detachInstance () doesn ' t exist on SceneNode & ChildrenMixin
function convertToComponent(node) {
    const component = figma.createComponent();
    if (node.type === "INSTANCE") {
        node = node.detachInstance();
    }
    component.resizeWithoutConstraints(node.width, node.height);
    for (const child of node.children) {
        component.appendChild(child);
    }
    copyPaste(node, component);
    node.remove();
    return component;
}
function convertToComponent ( node ) { const component = figma . createComponent ( ) ; if ( node . type === "INSTANCE" ) { node = node . detachInstance ( ) ; } component . resizeWithoutConstraints ( node . width , node . height ) ; for ( const child of node . children ) { component . appendChild ( child ) ; } copyPaste ( node , component ) ; node . remove ( ) ; return component ; }
FIXME: Typescript says detachInstance() doesn't exist on SceneNode & ChildrenMixin
FIXME : Typescript says detachInstance () doesn ' t exist on SceneNode & ChildrenMixin