question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

hardhat task from dedicated file -- fails to build with Typechain import

See original GitHub issue

Problem: cant use hardhat if task imports typechain contract; task has to be defined in dedicated file and imported into hardhat config;

Reproduce: https://github.com/rad-p/TypeChain/commit/128b6020cb73c9d5521a0e037bdec0efa9d8c24b

can’t use yarn hardhat

call:

 .../TypeChain/examples/hardhat
❯ yarn hardhat typechain

yarn run v1.22.10
$ /home/mr13/projects/ethereum-ts/TypeChain/examples/hardhat/node_modules/.bin/hardhat typechain
An unexpected error occurred:

tasks/counter.ts:2:23 - error TS2307: Cannot find module '../typechain' or its corresponding type declarations.

2 import {Counter} from "../typechain";
                        ~~~~~~~~~~~~~~

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

env:

❯ node --version
v14.16.1
 
❯ yarn --version
1.22.10

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:17 (10 by maintainers)

github_iconTop GitHub Comments

3reactions
mr13techcommented, Mar 9, 2022

agree to reopen this

3reactions
alcuadradocommented, Mar 9, 2022

The only workaround I know works is using import type {...} from "...", and running TS_NODE_TRANSPILE_ONLY=1 npx hardhat compile.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Task and typechain on first run · Issue #1511 - GitHub
I have to manually open hardhat.config.ts , comment the import of the tasks which import TypeChain, run the TypeChain task, then uncomment the...
Read more >
Hardhat errors | Ethereum development environment for ...
The most common source of errors is trying to import the Hardhat Runtime Environment from your config or a file imported from it....
Read more >
How to Build a Full Stack NFT Marketplace - V2 (2022)
If you get an error referencing your README.md, delete README.md and run npx hardhat again. Now you should see the following files and...
Read more >
How to create tests for your Solidity Smart Contract | by StErMi
When you create unit testing you are using Hardhat local blockchain and not a “real” one where people mint blocks every X seconds....
Read more >
Hardhat & Nomic Foundation: the creation of an Ethereum non ...
Building a DApp: What are DApps and why Meteor preview ... Nagy and Viktor Tron present on Swarm, the decentralised, incentivised file storage...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found