Here is a basic example:
export enum EnumA {
A = 'a',
}
export enum EnumB {
A = 'b',
}
export class SomeEntity {
id: string;
type: EnumA | EnumB;
}
const foo = (seArray: SomeEntity[]) => {
seArray.forEach((se) => {
Object.values(EnumA).includes(se.type)
})
}
However, an error is encountered:
TS2345: Argument of type 'EnumA | EnumB' is not assignable to parameter of type 'EnumA'. Type 'EnumB' is not assignable to type 'EnumA'.
Upon reviewing the ts docs, it is unclear why this error is occurring as se.type should be one of the values from the union of enums. Could there be some nuances about enums that I am overlooking?