coco var role: Role = Laya.stage.getChildAt(i) as Role;怎么用js 实现,在js中没有 as 写法,在js中 var role =Laya.stage.getChildAt(i); 得到的role 是Laya.Sprite类 不是我定义的Role
coco Laya_XS 我说的是 typescript里面的 as 关键字,不是说的是AS 开发语言,在typescript里用getChildAt得到对象后可以通过as关键字强制转换为自定义的Role类,但是在js中没有强制转换的说法,我在js中通过getChidAt得到的对象已经不是我定义的那个Role类了。