TypeChain
TypeChain copied to clipboard
Preserve inheritance
With contract code like contract Car is GroundVehicle and contract Truck is GroundVehicle I get types generated for CarInstance and TruckInstance and GroundVehicleInstance but when I have a function expecting a GroundVehicleInstance I can't pass in the CarInstance without a type error. This is because the types returned by a given function are incompatible: Type 'import("path/to/Car").AllEvents' is not assignable to type 'import("path/to/GroundVehicle").AllEvents'. Those incompatible types are the generic parameter to the Promise<Truffle.TransactionResponse<HERE>> type used in responses to functions.
This code would be much more useful if the inheritance could be preserved and used in that way.
Good point. This works fine with the ethers-v5 target but as long I can tell you are referring to the truffle target, right?
Yes, I am.
@krzkaczor I'm seeing inheritance chains being lost with the ethers-v5 target, the classes are being flattened down. Have there been any changes to the default behavior there recently?