Previously, i32 and u32 could not automatically come from string values when using nativeToScVal. Namely, nativeToScVal("4", { type: "i32" }) was explicitly forbidden. This was my design: the rationale was that if it's a 32-bit integer, it should be passed as a Number.
However, this logic does not hold true for maps, because in JavaScript, all map keys are strings. Therefore, creating an ScVal representing an integer-to-integer map is impossible via nativeToScVal, e.g., a function signature like this one:
Previously,
i32
andu32
could not automatically come from string values when usingnativeToScVal
. Namely,nativeToScVal("4", { type: "i32" })
was explicitly forbidden. This was my design: the rationale was that if it's a 32-bit integer, it should be passed as aNumber
.However, this logic does not hold true for maps, because in JavaScript, all map keys are strings. Therefore, creating an
ScVal
representing an integer-to-integer map is impossible vianativeToScVal
, e.g., a function signature like this one:cannot be executed by
because
1234
would be interpreted as a string, and thus could not be automatically converted to anumber
for au32
inference.