How can I write some thing like that?
type of elements
type = MyType; // is an Enum
myObj: MyObj | undefined = undefined;
myObj.type: MyType;
Currently
*ngIf="type.first === myObj.type || type.second === myObj.type"
how I try to refactor it
*ngIf="[type.first, type.second].include(myObj?.type)"
why? it's easier to read
the Error I get
Argument of type 'MyType | undefined' is not assignable to parameter of type 'MyType'.
How can I make the second way without needing to create new method?
ADD
how I currently fixed it
*ngIf="[type.first, type.second].include($any(myObj?.type))"