wangdoc / typescript-tutorial

TypeScript 教程
https://wangdoc.com/typescript
2.43k stars 256 forks source link

类、class、11 #113

Closed AkimotoReiko closed 2 months ago

AkimotoReiko commented 2 months ago

对于那些只设置了类型、没有初值的顶层属性,有一个细节需要注意。 这个例子中, target 设置为大于等于ES2022,代码的执行结果打印的不是 undefined,但是设置 useDefineForClassFields 为 true 就会打印 undefined,这里的疑问点就是 es2022 好像没生效,另外这一章提到了 tsconfig.json,但是这一章里面没有关于 useDefineForClassFields 的记载

AkimotoReiko commented 2 months ago

image

ruanyf commented 2 months ago

谢谢指出,这个部分完全重写了。

AkimotoReiko commented 2 months ago

感谢阮老师