Uniswap / v3-core

🦄 🦄 🦄 Core smart contracts of Uniswap v3

Home Page:https://uniswap.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Got an Error when Testing BitMath.spec.ts

arjunaskykok opened this issue · comments

I got an error when doing the npx hardhat test step.

The steps:

$ git clone https://github.com/Uniswap/v3-core
$ cd v3-core
$ npm install
$ npx hardhat compile
$ npx hardhat test
Creating Typechain artifacts in directory typechain for target ethers-v5
Successfully generated Typechain artifacts!
An unexpected error occurred:

test/BitMath.spec.ts:12:12 - error TS2352: Conversion of type 'Contract' to type 'BitMathTest' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
  Type 'Contract' is missing the following properties from type 'BitMathTest': addListener, getGasCostOfLeastSignificantBit, "getGasCostOfLeastSignificantBit(uint256)", getGasCostOfMostSignificantBit, and 5 more.

12     return (await factory.deploy()) as BitMathTest
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

OS: Ubuntu Linux 20.04
Node: v16.10.0

Try reinitializing your project:

nvm install --lts
nvm use --lts

The problem persists.

$ nvm install --lts
$ nvm use --lts
$ node --version
v18.14.0
$ rm -rf node_modules
$ npm install
$ npx hardhat compile
$ npx hardhat test
Creating Typechain artifacts in directory typechain for target ethers-v5
Successfully generated Typechain artifacts!
An unexpected error occurred:

test/BitMath.spec.ts:12:12 - error TS2352: Conversion of type 'Contract' to type 'BitMathTest' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
  Type 'Contract' is missing the following properties from type 'BitMathTest': addListener, getGasCostOfLeastSignificantBit, "getGasCostOfLeastSignificantBit(uint256)", getGasCostOfMostSignificantBit, and 5 more.

12     return (await factory.deploy()) as BitMathTest
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I am facing the same issue

Now using node v18.16.0 (npm v9.5.1)

Was this ever resolved? Could you please let me know what worked?

commented

use yarn install

delete your node_modules and yarn.lock, then:

yarn install
yarn run test