question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ethers 4.0.43 breaks type generation

See original GitHub issue

Upgrading our codebase from ethers 4.0.41 to 4.0.43 breaks the generated types during compilation.


src/generated/BasicConsumerFactory.ts:13:11 - error TS2345: Argument of type '({ constant: boolean; inputs: { name: string; type: string; }[]; name: string; outputs: never[]; payable: boolean; stateMutability: string; type: string; anonymous?: undefined; } | { constant: boolean; inputs: never[]; ... 5 more ...; anonymous?: undefined; } | { ...; } | { ...; })[]' is not assignable to parameter of type 'string | (string | FunctionFragment | EventFragment)[] | Interface'.
  Type '({ constant: boolean; inputs: { name: string; type: string; }[]; name: string; outputs: never[]; payable: boolean; stateMutability: string; type: string; anonymous?: undefined; } | { constant: boolean; inputs: never[]; ... 5 more ...; anonymous?: undefined; } | { ...; } | { ...; })[]' is not assignable to type '(string | FunctionFragment | EventFragment)[]'.
    Type '{ constant: boolean; inputs: { name: string; type: string; }[]; name: string; outputs: never[]; payable: boolean; stateMutability: string; type: string; anonymous?: undefined; } | { constant: boolean; inputs: never[]; ... 5 more ...; anonymous?: undefined; } | { ...; } | { ...; }' is not assignable to type 'string | FunctionFragment | EventFragment'.
      Type '{ inputs: { name: string; type: string; }[]; payable: boolean; stateMutability: string; type: string; constant?: undefined; name?: undefined; outputs?: undefined; anonymous?: undefined; }' is not assignable to type 'string | FunctionFragment | EventFragment'.
        Type '{ inputs: { name: string; type: string; }[]; payable: boolean; stateMutability: string; type: string; constant?: undefined; name?: undefined; outputs?: undefined; anonymous?: undefined; }' is not assignable to type 'FunctionFragment'.
          Types of property 'name' are incompatible.
            Type 'undefined' is not assignable to type 'string'.

13     super(_abi, _bytecode, signer);
             ~~~~

src/generated/BasicConsumerFactory.ts:40:34 - error TS2345: Argument of type '({ constant: boolean; inputs: { name: string; type: string; }[]; name: string; outputs: never[]; payable: boolean; stateMutability: string; type: string; anonymous?: undefined; } | { constant: boolean; inputs: never[]; ... 5 more ...; anonymous?: undefined; } | { ...; } | { ...; })[]' is not assignable to parameter of type 'string | (string | FunctionFragment | EventFragment)[] | Interface'.
  Type '({ constant: boolean; inputs: { name: string; type: string; }[]; name: string; outputs: never[]; payable: boolean; stateMutability: string; type: string; anonymous?: undefined; } | { constant: boolean; inputs: never[]; ... 5 more ...; anonymous?: undefined; } | { ...; } | { ...; })[]' is not assignable to type '(string | FunctionFragment | EventFragment)[]'.

40     return new Contract(address, _abi, signerOrProvider) as BasicConsumer;

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
ricmoocommented, Jan 28, 2020

That change should not have been breaking, since anyone passing in an object of that type would have crashed 2 lines later, but I will put ParamType back into the typing, and rely on runtime errors, which is no worse than previous behaviour.

Sorry for the inconvenience.

1reaction
krzkaczorcommented, Feb 5, 2020

Thanks for notifying me @HenryNguyen5 I’ll just close it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Documentation - Ethers.js
Solidity provides two types of events, anonymous and non-anonymous. ... Even secure passwords would likely be broken within a short period of time....
Read more >
Typings issue for abi files in v4 #633 - ethers-io/ethers.js
On ethers 4.0.37 I get this issue: import { Contract, providers, Signer, ... I've also found that enabling JSON in TypeScript breaks things ......
Read more >
ethers/CHANGELOG.md - UNPKG
- Fix backwards compatibility with certain parsed JSON objects passed into Interface and Contracts ([#721](https://github.com/ethers-io/ethers.js/issues/721); [ ...
Read more >
ethers - npm
Start using ethers in your project by running `npm i ethers`. ... ethers. TypeScript icon, indicating that this package has built-in type ......
Read more >
Resolution Changelog | Unstoppable Domains Developer Portal
1. Fixed bug regarding incompatable types with Ethers InfuraProvider; Remove ability to read from registry directly. ProxyReader address is now ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found