如何解决打字稿错误 'x' has no initializer and is not definitely assigned in the constructor?
How can I solve typescript error 'x' has no initializer and is not definitely assigned in the constructor?
我遇到错误
Property 'duni' has no initializer and is not definitely assigned in the constructor.ts(2564)
在下一行
@ViewChild('bhondu') duni: ElementRef<HTMLTableDataCellElement>;
使用 ?
将其设为可选会在我使用 this.duni.nativeElement
给出 Object is possibly 'undefined'.ts(2532)
的其他地方破坏代码。如何在不更改配置文件中的任何 属性 的情况下解决此错误 ?
@ViewChild('bhondu') duni!: ElementRef<HTMLTableDataCellElement>;
我遇到错误
Property 'duni' has no initializer and is not definitely assigned in the constructor.ts(2564)
在下一行
@ViewChild('bhondu') duni: ElementRef<HTMLTableDataCellElement>;
使用 ?
将其设为可选会在我使用 this.duni.nativeElement
给出 Object is possibly 'undefined'.ts(2532)
的其他地方破坏代码。如何在不更改配置文件中的任何 属性 的情况下解决此错误 ?
@ViewChild('bhondu') duni!: ElementRef<HTMLTableDataCellElement>;