joshstevens19 / ethereum-abi-types-generator

Generate typings based on your ABIs, with provider wrappers exposed.
MIT License
163 stars 22 forks source link

Duplicate length properties on responses #40

Open jackmellis opened 2 years ago

jackmellis commented 2 years ago

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...

joshstevens19 commented 2 years ago

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

jackmellis commented 2 years ago

That's correct, yes.

joshstevens19 commented 2 years ago

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

jackmellis commented 2 years ago

Thanks for the quick response ❤️