什么地方可以关掉这个提示
好烦呀
前面声明类型的时候 panel指明是 node或者null类型呀因为getChild返回有可能返回的是null而你在声明panel的时候指明的是node类型的
private finishCallFunc: Function | undefined; private panel:Node | null;这样
这个我知道。但是很多代码都是从2.4考过了的。
我想把这个提示禁止掉
为什么要禁掉呢? getchild 后面加 as强转为node
var roomsWidth = this.roomNode.getComponent(UITransform)?.width ?? 0 * list.length + (this.roomParent.getComponent(Layout) as any).spacingX * (list.length - 1);
2.4里简简单单的一句。到这里手指都快敲断了,考过来的代码。全部要改。
用3.0还得全新的项目
是开了ts严格模式吧?
求怎么关闭
“compilerOptions”: {
"module": "commonjs",
"lib": [
"es2015",
"es2017",
"dom"
],
"strict": false,
"target": "es5",
"experimentalDecorators": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
}
这样好像不行"strict": false,
谢谢。搞定了。要重启
“strict”: false,
其他都可以了,但使用Tween的时候,还是显示红线:
也没有错误提示~
cc.Tween?
对对,
import { Tween, tween,Color, Material, resources } from ‘cc’;
let tween_node: Tween;//这里一直是红线
tween_node = tween(this.Model_twinkle)
.delay(1)
.hide()
.delay(0.5)
.show()
.union()
.repeat(Infinity);
tween_node.start();

这个Tween是个泛型,如果是针对Node的Tween,可以写
Tween<Node>