dethcrypto / dethcrypto/TypeChain

Types are not generated if hardhat config file is not typescript

Open
#879 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
2.8k
Forks
376
PR merge metrics
No merged PRs in 30d

Description

I have a package.json with `"type": "module"` and am attempting to get Hardhat to play nice with TypeScript and ESM.

I've noticed that if I have a config file `hardhat.config.cjs`, then it doesn't generate any types. However, if I rename that same file to `hardhat.config.cts` (with a test patch for `hardhat` so that it supports this config file), suddenly it generates types. Here's a log to demo this:

```bash
╰─ ls hardhat* ─╯
hardhat.config.cjs

╰─ hardhat clean && hardhat compile ─╯
Compiled 57 Solidity files successfully (evm target: paris).

╰─ mv hardhat.config.cjs hardhat.config.cts ─╯

╰─ hardhat clean && hardhat compile ─╯
Generating typings for: 57 artifacts in dir: typechain-types for target: ethers-v6
Successfully generated 134 typings!
Compiled 57 Solidity files successfully (evm target: paris).
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.