Skip to content

Incompatible BigNumber types across versions #712

@julientregoat

Description

@julientregoat

hi @ricmoo! first off, thank you for all of your work on the ethers project. I really appreciate how you've laid the project out, seems like you've thought of everything. it has made it a lot more of a pleasure working with ethereum over the past 1.5 years i've been using ethers.

encountered some compile issues when loading up a React project on a new computer. it looks like there is a discrepancy with the BigNumber type between two different versions of ethers. a dependency is on a slightly older version of ethers.

I'm wondering if this has anything to do with my version of node, since I didn't have a problem on my other computer (node 10.16 I think). I quickly looked into the issue the error describes, but I couldn't find any difference in the Hexable interface or _hex properties - looked exactly the same. I didn't have time to continue digging but I'm happy to contribute a solution if you might be able to point me in the right direction.

For now, downgrading my project to 4.0.28 works.

  • node 12.14.1
  • ethers 4.0.42 (my project)
  • ethers 4.0.28 (dependency)
Failed to compile.

Type 'import("/<repo>/node_modules/<dependency>/node_modules/ethers/utils/bignumber").BigNumber' is not assignable to type 'import("/<repo>/node_modules/ethers/utils/bignumber").BigNumber'.
  Types have separate declarations of a private property '_hex'.  TS2322

    104 | 
    105 |     const params = await this.contract.functions.params()
  > 106 |     this.config.paramA = params.A
        |     ^

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionQuestions, feedback and general information.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions