1

I have a contract with an interface that I want to test with hardhat the contract looks like this

interface IGame {
    function play(uint guess) external;
}

contract Test {
    address private owner;
    IGame gameContract;
....
}

So when I import its type into the test file I receive an error telling that the function from the interface is absent....

Property 'play' is missing in type 'BaseContract & Omit<ContractInterface, keyof BaseContract>' but required in type 'Game'

What's the right way of fixing it? Thank you

using the this.contract instead of its type? But the code would become harder to read... is there a way without using this.? Thanks

1 Answer 1

0

I guess the right way to do it is to deployContract('ONLY THE CONTRACT NAME WITHOUT THE PATH gives you the needed interface')

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.