【问题标题】:Does web3.js have TypeScript type definition?web3.js 有 TypeScript 类型定义吗?
【发布时间】:2021-04-19 12:14:50
【问题描述】:

任何版本的 Web3 都有类型吗?我在 Node.js 中编写后端 API,我更喜欢用 TypeScript 编写。

我之所以这么问,是因为我一直在尝试使用 Web3 在 TypeScript 中编写 Express 应用程序并且遇到了这个错误(以及更多错误):

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

【问题讨论】:

    标签: javascript typescript ethereum web3 web3js


    【解决方案1】:

    比 1.3.0 更新的最新 web3.js 版本支持 TypeScript。

    More information in web3.js release notes

    【讨论】:

      猜你喜欢
      • 2021-04-06
      • 2019-02-16
      • 2017-12-21
      • 2019-04-01
      • 1970-01-01
      • 2017-10-18
      • 2018-09-17
      • 2021-03-26
      • 2016-06-22
      相关资源
      最近更新 更多