In my scenario, I have two classes: class A and class B. Class B extends class A. The issue arises when we consider a method in both classes. Class A has a method that accepts AProperties enum as its first argument. However, class B has a similar method that accepts either AProperties or BProperties enum as its first argument.
enum AProperties {
X,
Y
}
enum BProperties {
Z,
W
}
class A {
setProperty(property: AProperties, value: number) {
}
}
class B extends A {
setProperty(property: AProperties | BProperties, value: number) {
}
}
It seems redundant to have the setProperty method in class B, since it is identical to the one in class A. This method is only added for the TypeScript editor to recognize that it can accept both AProperties and BProperties. However, when the code is compiled to JavaScript, having setProperty in class B serves no purpose.
Is there a way to prevent this redundant method from being included in the JavaScript compilation? Perhaps adding a comment before the method could effectively address this issue.