So, every time I click a component on the screen, the node gets detected via this evenetData?.node method. I save it as a SceneNode. Later I want to access the node.children Property. The compiler however says that the node might not have that attribute, and marks it as an error. The program runs fine, however it’s quite annoying to always have 10+ errors in your file. Had anyone ever had a similar problem?
const node: SceneNode = eventData?.node;
function getAllNodes(node: SceneNode, arrayWrapper: { data: stringn] }) {
if(node.children){
for(let i = 0; i < node.children.length; i++){
getAllNodes(node.childrenei], arrayWrapper);
}
}
else{
if(node.type === "TEXT") arrayWrapper.data.push(node.characters);
if(node.type === "VECTOR") arrayWrapper.data.push(node.parent.name);
}
}