Closed ryanleecode closed 2 months ago
Why would this be a bug? Please elaborate better, because this looks to me as someone purposely shooting themselves in the foot.
Why would it not be a bug? It doesnt compile
you have a typed union of two descriptors polkadot people and westend people both sides have the same checksum yet it doesnt compile as a union but when passed the same parameters without a union it compiles.
this is a perfectly legitimate usecase
Open a discussion if you if you wish, and whenever I have time I will explain how you can use TS effectively to achieve this.
In the meanwhile, please do know that when you do things like this:
const network: keyof typeof descriptorMap = "westend2" as keyof typeof descriptorMap;
const peopleApi = client.getTypedApi(descriptorMap[network]);
then, as you can imagine, the calls that don't have enough type overlap, like utility.batch
won't work, not even with an empty array. Therefore, if you really want to do that kind of stuff (which most of the times you shouldn't), then you have to pick one of the APIs. For instance, you could do:
(peopleApi as TypedApi<typeof descriptorMap['westend2']>).tx.Utility.batch({ calls });
number 3 doesnt compile but 2 and 1 does. the checksums are also the same on both sides.