How can I solve typescript error 'x' has no initializer and is not definitely assigned in the constructor?

Viewed 3920

I am getting error

Property 'duni' has no initializer and is not definitely assigned in the constructor.ts(2564)

at the line below

  @ViewChild('bhondu') duni: ElementRef<HTMLTableDataCellElement>;

Making it optional using ? breaks code at other place where I use this.duni.nativeElement givingObject is possibly 'undefined'.ts(2532) . How can I solve this error without changing any property in the config files?

1 Answers
Related