Reputation:
I have used a safe navigation operator
in my code.
But angular gives an error when I execute the code.
Why this error: Because typescript
takes it's a ternary operator ?::
but I used it as a
safe navigation operator
.
So how to solve this Issue?
version:
"typescript": ~2.9.2
,
Angular: 6
Upvotes: 0
Views: 589
Reputation: 9903
Based on this Optional chaining
only supported as of TypeScript 3.7
or later.
So you need to update your typescript version or use traditional way of checking null:
if($event && $event.actionField && $event.actionField.toLowerCase()=="..."){}
Upvotes: 1