Open alcuadrado opened 4 years ago
Hey @krzkaczor I bumped into that error while working with Buidler, and @alcuadrado is actually helping me out.
My current workaround is to comment out lines 8 and 13 in index.d.ts:
// declare type Web3 = import("web3");
// declare const web3: Web3;
Pls let me know if you need more info.
You use @alcuadrado @ajsantander truffle@5
right? Here's basic support: https://github.com/ethereum-ts/TypeChain/pull/199
Tomorrow I will try to wrap it and release (in the worst case as beta).
Great, thank you!
You use @alcuadrado @ajsantander truffle@5 right?
Yep
@alcuadrado can u prepare a reproduction example for me? I can reproduce it. I just migrated https://github.com/ethereum-ts/truffle-typechain-example/pull/7 and I didnt encounter ANY issues...
Btw. i released truffle v5 target as @typechain/truffle-v5@0.9.0
@krzkaczor I studied the problem a bit more, while trying to reproduce the issue in a standalone project. I understand it a bit better now.
To reproduce, clone and install: https://github.com/ajsantander/typechain-error-sample
Typechain generates stuff that extends Truffle.ContractInstance from truffle-typings. If you ever want to use the abstract Truffle types like the Truffle.ContractInstance type in your own code, you have to install truffle-typings.
When doing so, 1.0.8 is installed, which produces the following error when attempting to compile typescript:
node_modules/truffle-typings/index.d.ts:8:21 - error TS1340: Module 'web3' does not refer to a type, but is used as a type here. Did you mean 'typeof import('web3')'?
8 declare type Web3 = import("web3");
However, I noticed that Typechain uses version 1.0.4 of truffle-typings, and when pinning to that version, the error is not thrown. As far as I'm concerned, this is a fix for me, but you may want to see a way to avoid this problem for others. There might be breaking changes in truffle-typings that Typechain needs to know about, or something like that.
Thank you! I will investigate it from now but I think you're right about breaking change somewhere in truffle typings. I will release version 1.0.4
as 2.0.0
and backport any useful changes from later as well.
I will let you know when it's done.
Hi @krzkaczor What is the status of this issue? This is a complete blocker to use the TypeChain project if I understand the problem correctly, isn't it?
@forshtat can u prepare some repro for me? Did you tried using 1.0.4
as noted above? Also, you can use patch-package
to fix your typechain locally if you don't want to wait for upstream fixes.
Hey @krzkaczor
I'm having a compilation problem with this package. Here's tsc output:
I believe the problem is that this package is based in
@types/web3
, and notweb3
's built-int.d.ts
files. These typings are incompatible, and the built-in ones "win" over the other, leading to this error.Do you know how can I fix it? Do you have plans to update this package?
Thanks!