Необходимо получить дельту (ключ/значение) измененных атрибутов между двумя объектами. Код машинописный. Два объекта были созданы одним и тем же интерфейсом.
export interface ITestObj {
att1: string;
att2: string[];
att3: string;
}
Я получаю сообщение об ошибке, что атрибут объекта нельзя использовать в качестве индекса. Не могу сделать что-то вроде этого:
if(objA['att1'] !== objB['att1']) {
}
Пытаясь исправить это, я попытался изменить интерфейс на:
export interface ITestObj {
[att1: string]: string;
att2: string[];
att3: string;
}
но это невозможно сделать, поскольку не все атрибуты являются строковыми (или числовыми, если на то пошло...).
Как я могу получить атрибуты, которые отличаются между objA и objB?
Большое тебе спасибо.