I checked the link you gave me and this is what I did:
// Function to check if node is a TextNode
function isText(node: SceneNode): node is TextNode {
return node.type === "TEXT"
}
// Create instance of my component
const myInstance = myComponent.createInstance()
// Get the node I want - in my case it's the 2nd layer
const myTextNode = myInstance.children[1]
// Since I know that it's a TextNode I can use my simple function
if (isText(myTextNode)) {
myTextNode.characters = "My text here"
}