请问ccc1.5.2里使用ts开发的时候，定义组件不可以使用module吗？

tianyi2010
Thu, 06 Jul 2017 03:31:24 +0000

A.ts

const { ccclass, property } = cc._decorator;
module test {
@ccclass
export default class A extends cc.Component {
print()
{
cc.log(“A print!”)
}
}
}

B.ts
import A from ‘./A’;
const { ccclass, property } = cc._decorator;
module test {
@ccclass
export default class B extends cc.Component {
onLoad() {
// init logic
this.node.getComponent(A).print();
}
}
}

错误提示如下：

[ts] File ‘d:/CreatorDemo/Javascript/assets/Script/A.ts’ is not a module.

阅读整个主题