My dilemma involves an interface set up as follows:
interface A {
a: string;
}
interface B {
b: string;
}
export interface C {
rnd: A;
rnd2: B;
}
I am seeking a function like update<T>(setting: T)
which can identify the property of type T
within an object that implements interface C
, and then update the value of that property (if it already exists) with the passed setting
.
Is there a method to accomplish this task? I attempted iterating and using typeof
, but encountered the error message:
This condition will always return 'false' since types 'T' and 'string' has no overlap