-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using .connect()
causes type errors
#6126
Comments
Hi @kyrers, have you tried compiling the contract? This issue is typically caused by the types not being available, which often happens when the contracts have not been compiled yet. When starting a new Hardhat project, the example contract is available, but you still need to compile it. Try running npx hardhat compile and then reloading your VS Code to see if the error is resolved. |
Thank you for the answer @schaable. You are correct that running
This is my
I followed the documentation to the best of my knowledge. I also ran Here is the fixture I am using for the tests where this error shows up: You'll note that I am using EDIT: I tried |
Ok, more information. As I said in the previous comment, I managed to get rid of the Now, I also managed to get rid of the error
My new question is - did I make a mistake or are you aware of these issues? I followed these docs https://hardhat.org/ignition/docs/guides/tests#using-ignition-modules-as-fixtures which seem to suggest that what I was doing (using ignition to deploy modules in tests) is possible. |
Is the issue here not that So |
As I see it, there are two issues here:
|
I am wondering if we are getting a clash in Can you update your dependencies and reinstall node_modules to:
My thinking here is maybe you are getting a clash between the toolbox and the explicit ignition versions ( |
So, two things happen with the
You can even simplify that
With this simple
I guess the real questions here are:
|
Version of Hardhat
2.22.17
What happened?
I was writing some tests for ERC20 tokens and tried to use
.connect()
. I immediately got type errors saying thatProperty 'mint' does not exist on type 'BaseContract'
.I assumed I was doing something wrong, so I set up a new hardhat project using typescript and changed nothing, to my surprise the error was there too.
Minimal reproduction steps
Just follow the guide in the docs to create a typescript project and the error will be in the
Lock.ts
test file.Search terms
connect, type errors
The text was updated successfully, but these errors were encountered: