-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot use 'new' with an expression whose type lacks a call or construct signature #1491
Comments
Web3.js unfortunately doesn't use ES Modules, so you can't import it like that. You have to |
Thank you ! @macbem. First I use Web3.js in .ts file ,so invoking this module in |
As i said before, Web3.js doesn't use ES Modules, so you can't use default imports - you have to use |
Thank you! @macbem I try to do it ,why it's useful for others that use the ES Modules? Can you tell me the reason? And I don't know where the TypeScript config should be modified? the tutorial I don't know where have? |
What I ended up doing to stop typescript from complaining and still have type definition and autocompletion is
|
A issue in the
this.web3 = new Web3(window.web3.currentProvider)
; the web3.js has output and I type to the code ofconsole.log(window.web3.currentProvider)
thatwindow.web3.currentProvider
is defined. But the terminal occurs issue like as fellow:ERROR in src/app/app.service.ts(36,20): error TS2351: Cannot use 'new' with an expression whose type lacks a call or construct signature.
Environment:
system:Ubuntu16.04
web.js:"1.0.0-beta.33"
I import the web3.js like that :
import * as Web3 from 'web3';
The text was updated successfully, but these errors were encountered: