I have created two types
export class GenericType {
public id: string;
public property: string;
public name: string;
}
export class SpecificType extends GenericType {
public value: string;
}
Now I have two variable A: GenericType and B: SpecificType, now I want to assign all the values of A to B, and additionally, I want to assign value to B. How should I achieve this, I don't want to loop through A's all property and manually assign it to B's all property.
let varA: GenericType = {
id: '123',
property: 'exmple',
name: 'example variable',
};
let varB: SpecificType = new SpecificType();
varB = varA; <----- not allowing to assign.
varB.value = 'new value';