i´ve always use this kind of behavior show down here in angular *ngIf directive when i have an object that could be undefined or other than the required object
<div *ngIf="object?.foo">
...
</div>
i know that this works, but don´t know why...
But when i tried to use it on an if in my TypeScript file like following angular throw me two diferent errors TS1005, TS1109, alternating one to other, on each line that i try to use this behavior.
if(object?.foo){} // error TS1109
if(object?.foo){} // error TS1005
if(object?.foo){} // error TS1109
if(object?.foo){} // error TS1005
i'm using Angular 7.3.9 for this project