Getting parent of a node

Hello, Ive been trying to get parent of some SceneNode, however when I try node.parent I get runtime error “BaseNode&ChildrenMixin” is not assignable to parameter of type “SceneNode”.

I understand that I have to check whether the node supports .parent argument, but when I tried to make a typeguard for this, it just doesnt work. The idea is that this should give me only parents of instance&frame nodes.

function supportsParent(node:SceneNode): node is FrameNode | InstanceNode {
    return node.type === "FRAME" || node.type === "INSTANCE"
}

and then when im trying to do

if (supportsParent(node)){
 arr.push(node.parent)
}

I still get runtime error.

Any help appriciated