YourNewEmpire
YourNewEmpire

Reputation: 153

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);

Upvotes: 4

Views: 10640

Answers (1)

Mikko Ohtamaa
Mikko Ohtamaa

Reputation: 83606

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

More information in web3.js release notes

Upvotes: 10

Related Questions