ECMAScript icon indicating copy to clipboard operation
ECMAScript copied to clipboard

"target" : "ESNext" , onready装饰器不能正常使用。

Open scgm0 opened this issue 3 years ago • 2 comments

ts: image ESNext: image ES2021 & ES2020: image

ts装饰器不能将已定义的普通属性更改为 setter getter ,而 ESNext 的装饰器是修改原属性,ES2021 && ES2020 则是额外添加。

所以要使用onready装饰器,要么 target 改成 ES2021 || ES2020,要么原属性本身就是 setter getter。

希望默认生成的tsconfig.json的 target 改为 ES2021 || ES2020,我今天才发现怎么解决onready装饰器不能正常使用。。。

网络问题还重写了一次文,悲(

话说,大佬什么时候更新啊(笑)

scgm0 avatar Mar 07 '22 05:03 scgm0

Bro what you need is

tsconfig.json

"useDefineForClassFields":false

Here is a starting template

citizenll avatar Sep 14 '22 03:09 citizenll

兄弟你需要的是

tsconfig.json

"useDefineForClassFields":false

这是一个起始模板

噢,谢谢,我有解决的办法,但我更希望官方生成的模板能支持一下,毕竟也不是什么难事。

scgm0 avatar Sep 14 '22 04:09 scgm0