Error: Number can only safely store up to 53 bits

I got this error: ‘Error: Number can only safely store up to 53 bits’ when using toNumber function:

totalSupply.toNumber()

Quick fix using BigInt:

 BigInt(totalSupply)

Leave a comment