In a nutshell, I have an issue where I have two interfaces: User and SpecialUser. The User interface has an 'attributes' object with certain properties, while the SpecialUser interface requires the 'attributes' object to include additional properties not found in User. The problem arises when the new attributes object overwrites the old one instead of merging them together. Although I could make it work by copying all properties from the parent interface and then adding the later ones, this solution is far from ideal.
export interface User{
attributes: {
full_name: string;
}
}
export interface SpecialUser extends User {
attributes: {
occupation: string;
}
}
My goal is for SpecialUser's 'attributes' to combine the fields from User's 'attributes' with its own new properties (such as full_name and occupation). Unfortunately, the current outcome is that it completely replaces the original attributes.