const obj1 = { a: 1, b: "xx" };
const obj2 = { a: 2, b: "3", d: "hello" };
for (const key in obj1) {
const _key = key as keyof typeof obj1;
obj1[_key] = obj2[_key];
}
x[_key] error
Type 'string | number' is not assignable to type 'never'. Type 'string' is not assignable to type 'never'.
Is there any solution for this?
Fixing circular assignment
Due to different keys in the objects, I need to extract specific keys from obj.