I am trying to convert a web3 BigNumber into an ethersjs BigNumber but I can't create a Web3 BigNumber variable.

I am typing

import Web3 from "web3";
const web3 = new Web3;
let BN = web3.utils.BN;

And I get this error Property 'BN' does not exist on type 'Utils'. I am using typescript. Any idea how to solve the problem ?

Thank you

2 Answers 2


There is a discussion on here about that but basically you have two options (only the first one worked for me)

const Web3 = require("web3");

Or just add on tsconfig.json

    "noImplicitAny": false,

ethers.js have better typescript support , you should use ethers.js than web3 :>

You can also import BN.js instead since web3.js use BN.js under the hood

const BN = require('bn.js');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.