dethcrypto / dethcrypto/TypeChain

[Bug] Type 'Contract' is not assignable to type 'SomeContract'.

Open
#578 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 followed the official web3 example, but for some reason it throws a bunch of errors for me, because my case-scenario has deploy and send chained to the instance.

![Screenshot 2021-12-18 at 13 36 38](https://user-images.githubusercontent.com/3460368/146641393-64831685-6f08-4111-ac1b-04d8ffcd7318.png)

If I do it with this approach, then I don't have the deployed contract stored for the future interaction.
```ts
let factory: FactoryContext

// ... later on
factory = new web3.eth.Contract(FactoryArtifact.abi) as unknown as FactoryContext

await factory.deploy({ ... }}.send({ ... })

// ... later on
expect(factory.options.address).toBeTruthy() // error (undefined)
```

So I had to `@ts-ignore` the line, for now. Is there a solution to this that's not documented, because I'm struggling to find the way?

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.