You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I checked there isn't already an issue for the bug I encountered.
Viem Version
2.18.8
Current Behavior
You can pass incorrect values for args in encodeFunctionData without a type error
Expected Behavior
A type error just like if you use the abi field directly without using prepareEncodeFunctionData
Steps To Reproduce
You can see if I use prepareEncodeFunctionData, there is no type error detected
constconstInputData=prepareEncodeFunctionData({abi: [{inputs: [{internalType: 'string',name: 'input',type: 'string'}],name: 'convertedPaimaData',outputs: [],stateMutability: 'nonpayable',type: 'function',},],});constfoo=encodeFunctionData({
...constInputData,args: [1],// note: wrong data, but no error!});
However, if I inline the abi directly, it properly detects the error
constfoo=encodeFunctionData({abi: [{inputs: [{internalType: 'string',name: 'input',type: 'string'}],name: 'convertedPaimaData',outputs: [],stateMutability: 'nonpayable',type: 'function',},],args: [1],// error working properly as expected: Type 'number' is not assignable to type 'string'});
Link to Minimal Reproducible Example
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered:
This issue has been locked since it has been closed for more than 14 days.
If you found a concrete bug or regression related to it, please open a new bug report with a reproduction against the latest Viem version. If you have any questions or comments you can create a new discussion thread.
Check existing issues
Viem Version
2.18.8
Current Behavior
You can pass incorrect values for
args
inencodeFunctionData
without a type errorExpected Behavior
A type error just like if you use the
abi
field directly without usingprepareEncodeFunctionData
Steps To Reproduce
You can see if I use
prepareEncodeFunctionData
, there is no type error detectedHowever, if I inline the abi directly, it properly detects the error
Link to Minimal Reproducible Example
No response
Anything else?
No response
The text was updated successfully, but these errors were encountered: