Stricter Type Narrowing When using multiple ABIs as union #3869
Unanswered
selcuk-sahin
asked this question in
Question
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Depending on a condition, I would choose abi1 or abi2 and make some contract calls.
However between abi1 and and abi2, there's not much difference, so in most cases I could just re-use the existing calls like below.
What I noticed is, if both abis have the same function available, but with different args,
writeContract
permits either of args to be there.How can I enforce stricter args type when union of abis used?
Example below
Expectation
Generally with union in TypeScript acts more restrictive, which I found helpful.
In this case, supplying the ambiguous args might have been errored me.
Beta Was this translation helpful? Give feedback.
All reactions