I have an abstract class:
abstract class TableAdapter {
public abstract convertInputToOutput<InputType, OutputType> (apiRow: InputType): OutputType;
}
Now I am going to inherit from it for a set of classes:
class TableAdapter1 extends TableAdapter {
public convertInputToOutput (apiRow: InputType1): OutputType1 {
// return something of type OutputType1;
}
}
class TableAdapter2 extends TableAdapter {
public convertInputToOutput (apiRow: InputType2): OutputType2 {
// return something of type OutputType2;
}
}
I see an error while compiling:
Types of parameters 'apiRow' and 'apiRow' are incompatible. Type 'ApiRowType' is not assignable to type 'InputType1'
How do I fix it and set exact types in an inheriting class so that I could access objects' fields?