[LayaAirIDE 2.0]prop 识别不到

H6ERGKVP1@_}H7[9F(__6.png

新手,刚学习,是我哪里弄错了吗,请大佬们解答下小弟遇到的问题,谢谢
 
已经申明了prop,IDE中已经识别到了,但vscode报未定义,IDE F8编译时也不通过
 
代码:
export default class Index extends Laya.Script {
    /* @prop {name: speed, tips: "速度", type: Number, default: 10} */ 
    constructor() {
        super();
    } 
    onAwake() {
        console.log("场景渲染完成", this.speed);
    }
}
 
IDE中报错:
[15:26:34] Working directory changed to E:\LayaAirIDE\resources\app
 
[15:26:35] Using gulpfile E:\myLaya\demo2\.laya\compile.js
 
[15:26:35] Starting 'compile'...
 
[15:26:38] 'compile' errored after 2.84 s
[15:26:38] Error: E:/myLaya/demo2/src/start/Index.ts(9,36): semantic error TS2339: [31mProperty 'speed' does not exist on type 'Index'.[39m
at error (E:\LayaAirIDE\resources\app\node_modules\rollup\dist\rollup.js:9402:30)
at Object.error (E:\LayaAirIDE\resources\app\node_modules\rollup\dist\rollup.js:15621:24)
at Object.error (E:\LayaAirIDE\resources\app\node_modules\rollup\dist\rollup.js:16065:38)
at RollupContext.error (E:\LayaAirIDE\resources\app\node_modules\rollup-plugin-typescript2\dist\rollup-plugin-typescript2.cjs.js:17187:30)
at lodash_3 (E:\LayaAirIDE\resources\app\node_modules\rollup-plugin-typescript2\dist\rollup-plugin-typescript2.cjs.js:24954:23)
at arrayEach (E:\LayaAirIDE\resources\app\node_modules\rollup-plugin-typescript2\dist\rollup-plugin-typescript2.cjs.js:532:11)
at forEach (E:\LayaAirIDE\resources\app\node_modules\rollup-plugin-typescript2\dist\rollup-plugin-typescript2.cjs.js:9360:14)
at printDiagnostics (E:\LayaAirIDE\resources\app\node_modules\rollup-plugin-typescript2\dist\rollup-plugin-typescript2.cjs.js:24927:5)
at Object.transform (E:\LayaAirIDE\resources\app\node_modules\rollup-plugin-typescript2\dist\rollup-plugin-typescript2.cjs.js:26760:17)
at Promise.resolve.then (E:\LayaAirIDE\resources\app\node_modules\rollup\dist\rollup.js:15768:25)
已邀请:

大斌

赞同来自:

已经解决...看的教程应该是太老了,或者太模糊...需要声明同名变量

要回复问题请先

商务合作
商务合作