Skip to content
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

Prevent losing typechain types when compiling a subset of contracts #6458

Open
wants to merge 1 commit into
base: v-next
Choose a base branch
from

Conversation

antico5
Copy link
Contributor

@antico5 antico5 commented Mar 10, 2025

When compiling a subset of contracts, only the generated artifacts were being passed to typechain, losing the types of any previously generated artifacts.

This PR changes that, so besides passing the current generated artifacts, it passes all available artifacts in the project.

I had to adapt the test cases a bit since apparently on windows the generated files have a different directory structure than in linux/mac when having multiple contracts.

Closes #6311

Copy link

changeset-bot bot commented Mar 10, 2025

🦋 Changeset detected

Latest commit: dd31e81

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@nomicfoundation/hardhat-typechain Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Mar 10, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hardhat ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 10, 2025 2:21pm

@ChristopherDedominici
Copy link
Contributor

ChristopherDedominici commented Mar 11, 2025

Cool solution, I like it!
The only downside is that we do have to generate types for all the contracts, even though only a portion is compiled, but I don’t see any other solution.

@alcuadrado wdyt?

@antico5
Copy link
Contributor Author

antico5 commented Mar 11, 2025

Cool solution, I like it! The only downside is that we do have to generate types for all the contracts, even though only a portion is compiled, but I don’t see any other solution.

@alcuadrado wdyt?

I've checked typechain-ethers and there's no option to "merge" newly added artifacts into an existing type file (hardhat.d.ts). It just uses whatever is passed on allArtifacts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

Successfully merging this pull request may close these issues.

3 participants