Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does web3.js have TypeScript type definition?

Are there types for Web3 in any version? I am coding backend APIs in Node.js and I'd prefer to write in TypeScript.

I am asking this because I have been attempting to write Express apps in TypeScript with Web3 and had this error (and many more):

This expression is not constructable.
  Type 'typeof import("c:/Users/Archie/node_modules/web3-eth-contract/types/index")' has no construct signatures.

line: const contract = new Contract(abi.json, address);
like image 497
YourNewEmpire Avatar asked Oct 19 '25 14:10

YourNewEmpire


1 Answers

The latest web3.js versions newer than 1.3.0 come with TypeScript support.

More information in web3.js release notes

like image 71
Mikko Ohtamaa Avatar answered Oct 22 '25 06:10

Mikko Ohtamaa



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!