useWeb3ExecuteFunction leak of type msgValue in typescript

Hi Team,
I am using typescript + moralis for my project. I realized that the useWeb3ExecuteFunction() hook does not have msgValue property so that I am coming across the issue as below:

Type '{ contractAddress: string; functionName: string; abi: ({ inputs: never[]; stateMutability: string; type: string; anonymous?: undefined; name?: undefined; outputs?: undefined; } | { anonymous: boolean; ... 4 more ...; outputs?: undefined; } | { ...; } | { ...; })[]; params: { ...; }; msgValue: any; }' is not assignable to type 'Web3ExecuteFunctionParameters'.
  Object literal may only specify known properties, and 'msgValue' does not exist in type 'Web3ExecuteFunctionParameters'.

![Screen Shot 2021-12-20 at 1.59.12|690x279]

I am pretty sure that the msgValue is the property of this hook because it is working when using javascript (I actually tried)
And I checked the official video it also makes use of this property (1:17:44). (https://www.youtube.com/watch?v=WZWCzsB1xUE&t=4805s)

Please let me know if I am somehow missing anything?

can you make it somehow to ignore that typescript error for msgValue?

Hi Cryptokid, Thanks for the prompt reply.
It is working normally when I run on test server without build. But it will fail when I build the project and it turns out the error:

Type error: Type '{ contractAddress: string; functionName: string; abi: ({ inputs: never[]; stateMutability: string; type: string; anonymous?: undefined; name?: undefined; outputs?: undefined; } | { anonymous: boolean; ... 4 more ...; outputs?: undefined; } | { ...; } | { ...; })[]; params: { ...; }; msgValue: any; }' is not assignable to type 'Web3ExecuteFunctionParameters'.
  Object literal may only specify known properties, and 'msgValue' does not exist in type 'Web3ExecuteFunctionParameters'.

  154 |                     _to: web3Context.addr,
  155 |                 },
> 156 |                 msgValue: web3.utils.toWei(bnbInputVal!.toString()),
      |                 ^
  157 |             },
  158 |             // onComplete: ()=>{},
  159 |             onSuccess: (res)=>{console.log("SUCCEEDED:", res); clearbuyingInfo(); getBalances()},
info  - Checking validity of types .npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] export: `next build && next export`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] export script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:

Could you let me know how to somehow bypass it if you have any idea.
Thanks

add // @ts-ignore on top of the msgValue line that should ignore the typescript strict typing checks

2 Likes

Thanks, YosephKS, I will do it this way.

1 Like