Shouldn’t this throw an error?
I was able to deploy this to mainnet and the method didn’t even throw or smth
Shouldn’t this throw an error?
I was able to deploy this to mainnet and the method didn’t even throw or smth
maybe @chenyan knows why. please note that WHITELIST_CANISTER
is an external canister defined like this
let WHITELIST_CANISTER = actor "s7o6c-giaaa-aaaae-qac4a-cai" : actor {
getWhitelist: shared () -> async [Principal];
};
I can confirm that getWhitelist
indeed returns an Array of Principals, but Env.modclubWhitelist
is actually an Array of Text
(AccountIdentifier = Text
) …
The screenshot says Env.modclubWhitelist : [AccountIdentifier]
Are you sure AccountIdentifier
isn’t a subtype of Principal
?
Yes, see below
These are immutable arrays so subtyping applies and both array types also have common super type ‘[Any]’, and can be appended to produce another array of that type.
I suspect that is what is happening here.