dethcrypto / dethcrypto/TypeChain
getting wrong type after .connect()
- 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
Assessment
This issue has not been assessed yet.