I am trying to compare two objects, but for some reason it is not working as expected.
Here is the code snippet I am using:
export class SourceValues {
...
static INDICATOR: ISourceValue = { text: 'Indicator', value: 'Indicator' };
...
}
Elsewhere in the code:
let a = { text: 'Indicator', value: 'Indicator' } as ISourceValue;
...
if(a === SourceValues.INDICATOR){ // No changes should be needed here
//do something
}
When this code is executed, both a
and SourceValues.INDICATOR
seem to hold the same value/object, yet the comparison does not work as expected. Any insights on why this might be happening would be greatly appreciated. Thank you.