Understanding Contract Method Call Return Types in web3.js 4 #7415
Unanswered
BigBadAlien
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
According to the documentation at https://docs.web3js.org/guides/smart_contracts/infer_contract_types/:
The
balanceOf
method is typed, but the variablebalance
has the typeMatchPrimitiveType<"uint8", unknown>
. It doesn't throw an error in the case:This suggests that the return type isn’t strictly enforced. I suppose this might be due to formatters flexibility. Is the intended approach to always set the return type explicitly, like
const balance: bigint
?Beta Was this translation helpful? Give feedback.
All reactions