Generate interfaces for structs alongside existing struct types
PR https://github.com/dethcrypto/TypeChain/pull/700 changed how struct types are generated. I've been importing these structs (before the properties were wrapped by PromiseOrValue<T>) to help me type check inputs in hardhat tests.
Perhaps alongside the existing struct types you could provide an interface type also:
export interface Foo {
a: BigNumberish;
b: BigNumberish;
};
export type FooStruct = {
a: PromiseOrValue<BigNumberish>;
b: PromiseOrValue<BigNumberish>;
};
export type FooStructOutput = [BigNumber, BigNumber] & {
a: BigNumber;
b: BigNumber;
};
maybe generating PromiseOrValue<T> vs T should be done behind a flag? If PromiseOrValue<T> is possible in ethers it does not mean that it's good(like it is possible to write {} + [] in javascript but it does not mean that it's good code).
PromiseOrValue seems to have caused inconvenience for a lot of people. I'd incline towards getting rid of it if we can't have it behind a flag.
@zemse is getting rid of PromiseOrValue still the plan? I've been hoping for that to happen given how wide the impact is, but if not, I guess I better get to fixing those 127 type errors this change introduced 😓
In v6 target, there's no PromiseOrValue. For v5 I've just opened up a PR.