Imagine we have two distinct classes X and Y with 77 property-type declarations in common, but their methods, including constructors, are different:
class X {
public prop1: number;
public prop2: string;
//...
public prop77: "hello";
constructor(){
this.prop1 = 5;
//...
}
}
class Y {
public prop1: number;
public prop2: string;
//...
public prop77: "hello";
public prop78: number;
//... more properties
constructor(){
// they initialize properties in a different way
this.prop1 = 879;
//...
this.prop78 = 8;
}
}
Is there a way to utilize the first 77 type declarations from class X in class Y? Can Y extend the type declaration of X?
I've looked extensively but haven't found a solution.
How can I prevent redundant property declarations in this scenario?