Uniswap / v3-periphery

🦄 🦄 🦄 Peripheral smart contracts for interacting with Uniswap v3
https://uniswap.org
GNU General Public License v2.0
1.19k stars 1.12k forks source link

Typescript error in Base64.spec.ts, Conversion of type 'Contract' to type 'Base64Test' #237

Open raxuser100 opened 2 years ago

raxuser100 commented 2 years ago

Downloaded the repo, unmodified and attempted to run hardhat tests. Getting a typescript error, when executing terminal command npx hardhat test

test/Base64.spec.ts:15:14 - error TS2352: Conversion of type 'Contract' to type 'Base64Test' 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 'Base64Test': addListener, encode, "encode(bytes)", getGasCostOfEncode, "getGasCostOfEncode(bytes)"

15     base64 = (await (await ethers.getContractFactory('Base64Test')).deploy()) as Base64Test
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LTangaF commented 2 years ago

@raxuser100 I'd run into the same issue, too, but when I examined .github/workflows/tests.yml, I discovered that I should've been runing Node 12.x instead of the Node 14.x that I was running.

So, I launched it in a container running that version and had to fix a line in NonfungiblePositionManager.spec.ts to cast gasPrice as BigNumberish in order to have tests with no errors:

expect(balanceBefore).to.eq(balanceAfter.add(receipt.gasUsed.mul(tx.gasPrice as BigNumberish)).add(100))

That seems to have fix the majority of the test errors.

While perhaps some better documentation in the README will clear this up for others in the future, it may not be a bug.