Handling Overloaded Functions #139
-
I'm struggling with using AbiType to handle overloads - it appears that the various input types of are parsed correctly, but the return types are For example, given an ABI:
the resulting typed output for TypeChain would handle this by deduping the function name based on args, so I'm not sure if the type extraction system is expressive enough to handle the overload case? My TypeScript expertise is not quite sufficient to be able to understand how to accomplish something like this. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
We currently are aware that this is a problem on overloads. Before wagmi v1 the workaround for this was similar. Reference However with the introduction of viem this no longer applies. The current idea to solve this problem is to narrow the return type based on the provided arguments on those overload functions. So in your example if you just pass the one address as the argument then it would be able to infer the correct return type based on it. This is currently on the "whiteboard" and should be something that gets solved in the near future. |
Beta Was this translation helpful? Give feedback.
-
Example implementation merged in #149 |
Beta Was this translation helpful? Give feedback.
Example implementation merged in #149