I'm using Angular 14. I have an enum ...
export enum MyEnum {
First,
Second
}
then I hvae an object that declares one of its fields to be that enum
export class MyModel {
...
myField !: MyEnum;
...
In a component, I want to check if the field matches a particular enum value, so I tried
<span *ngIf="!myObj || myObj.myField != 'Second'" class="p-float-label">
but this results in the compilation error
error TS2367: This condition will always return 'true' since the types 'MyEnum' and 'string' have no overlap.
What's the proper way to compare an enum value?