ethereum-abi-types-generator icon indicating copy to clipboard operation
ethereum-abi-types-generator copied to clipboard

Duplicate length properties on responses

Open jackmellis opened this issue 2 years ago • 4 comments

If a contract method response has a length property on it, the generator creates an interface something like this:

interface SomeMethodResponse {
  someProperty: boolean;
  0: boolean;
  someOtherProperty: BigNumber;
  1: BigNumber;
  length: BigNumber;
  2: BigNumber;
  length: 3;
}

the two conflicting length properties cause typescript (and esilnt) errors. I think that (at least for ethersv5) if you have a length property, it gets renamed to _length so I think this should mimic that behaviour...

jackmellis avatar May 23 '22 12:05 jackmellis

oh good catch.. so to confirm you have something called "length" on ABI ethers turns it to _length right? or the other way around?

joshstevens19 avatar May 23 '22 12:05 joshstevens19

That's correct, yes.

jackmellis avatar May 23 '22 13:05 jackmellis

good to know will look at both your issues the type one may be a bit more of a rewrite but we should support it thanks for raising

joshstevens19 avatar May 23 '22 13:05 joshstevens19

Thanks for the quick response ❤️

jackmellis avatar May 23 '22 13:05 jackmellis