Currently, I am enhancing a class by adding a serialize
method. My goal is for this new method to perform the same functionality as its parent class but with some additional keys added.
export declare class Parent {
serialize(): {
x: number;
y: number;
};
}
export default class Child extends Parent {
serialize() {
return {
...super.serialize(),
something: 'extra'
};
}
}
I am interested in defining a type specifically for my extended class - perhaps named SerializedChild
. Is it feasible in this scenario, and if so, what steps should I take to achieve that?