resources.load(“EditBox”,Prefab,(err, prefab) => {
const aNode = instantiate(prefab)
console.log(aNode);
this.node.addChild(aNode);
})
打印显示,aNode已经是一个节点,也能正常加到父节点上,但是aNode上有红色错误提示:
const aNode: Prefab | null | undefined
类型“Prefab | null | undefined”的参数不能赋给类型“Node”的参数。
不能将类型“undefined”分配给类型“Node”。ts(2345)