You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This line in the Contract class is pulling back the power of typescript.
constrainbowInstance=RainbowFactory.connect(address,provider);rainbowInstance.methodThatDoesntExist();// any
If solidity method methodName is renamed to methodName2, there should be typescript errors in the typescript project to be able to fix it. But ATM, it doesn't error in this case due to the wild card in the original Contract class.
Is there any way to disable/override this wildcard? It'd enable errors before runtime in projects! I think it can be a great addition to ethers v5 target (as well as help me to smoothly introduce breaking changes in my current project's test-net contracts in test-cases as well as UIs).
The text was updated successfully, but these errors were encountered:
This is definitely a problem. I tried to tackle it in the past but finally gave up.
I see two solutions:
Try to use type-level-programming (Omit) to drop [ key: string ]: ContractFunction | any; It's possible to fix subtypes with wildcards using this approach (like functions) but I didn't have any luck fixing top-level wildcard.
Simply copy the whole Contract type and manually delete the wildcard. This approach can result in over-reliance on implementation details of ethersjs and break often in the future.
CC: @ricmoo Maybe ethers could expose BaseContract type without any wildcards?
This line in the
Contract
class is pulling back the power of typescript.If solidity method
methodName
is renamed tomethodName2
, there should be typescript errors in the typescript project to be able to fix it. But ATM, it doesn't error in this case due to the wild card in the originalContract
class.Is there any way to disable/override this wildcard? It'd enable errors before runtime in projects! I think it can be a great addition to ethers v5 target (as well as help me to smoothly introduce breaking changes in my current project's test-net contracts in test-cases as well as UIs).
The text was updated successfully, but these errors were encountered: