UPDATE: After receiving CodeCaster's comment, I realized the issue was due to me using TypeScript version 3.5 instead of 3.7+. It was surprising because these checks seemed to be working fine with other Angular elements, such as
<div *ngIf="parts?.length"></div>
.
In my TypeScript code, I have the following snippet:
if (!this.session.draftData?.length) {
return;
}
I've successfully used similar checks in other parts of my code, but now the compiler is throwing this error: error TS1005: ':' expected.