dethcrypto / dethcrypto/TypeChain

getting wrong type after .connect()

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

Description

Hi
I am unable to use .connect() as it changes the type to what it has already generated regardless of the type I determined.
```
import { ethers } from "hardhat";
import {Lock, Lock2} from "../typechain-types"

type Lock1AndLock2 = Lock2 & Lock

describe("Sample", function() {
it("Should have the same type", async function() {
const Lock = (await ethers.getContractAt(abi, address)) as unknown as Lock1AndLock2; // type: Lock1AndLock2
const LockWithDifferentRunner = Lock.connect(undefined); // type: Lock2

/*
Currently:
Lock: Lock1AndLock2
LockWithDifferentRunner: Lock2
*/

/*
Expected:
Lock: Lock1AndLock2
LockWithDifferentRunner: Lock1AndLock2

why the type of LockWithDifferentRunner changed after conencting to a different runenr?
*/
})
})
```

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.