吐槽:合并类和模块以及cc.Enum的使用

如下示例:

export default class test extends cc.Component {
    @property({ displayName: "xxx", type: cc.Enum(test.a) })
    xxx = test.null;
}

export module test {
    export enum a {
        null,
        b,
        c,
    }
}

这样使用编辑器会报TypeError: Cannot use ‘in’ operator to search for ‘__enums __’ in undefined
但是把模块放在类上面又不能合并模块和类了。。除了模块改名不使用合并或者把枚举移出模块别无他法,蛋疼

cc.Enum 不能接收一个 ts 的枚举,这是两套东西

你可以考虑直接 const a = cc.Enum({null: -1, b: -1, c: -1}); test.a = a;