I have an interface (interfaceA
) that has 2 properties and another one (interfaceB
) that has 3 properties (The numbers are just for example).
I have created an object (type: interfaceB
) and I would like to create another object (type: interfaceA
) and copy only the values from the common properties from B to A.
One solution is to copy all the fields and delete the third one, but I don't like that.
Another solution is to create a new Object with only the properties that I need but I don't like that either.
In both solutions, if someone adds a property to one of the interfaces, I would have to add or delete the property in the assignment also.
Is there any solution to my problem?
I have created a StackBlitz to help you understand better.