-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem with types of getTransactionReceipt() and generic ReturnFormat #6372
Comments
Thanks for details in description section. blockhash is Bytes , that can be
or
|
Hi @jdevcs, yes i can "cast as", but the questions is why have such specification in the signatures if the returned type might be the union of both.. ? Furthermore, in my case there is an interface in place expecting it as string, i might do the union there only to propagate the typecheck across all other resources that use such class. The point is, is this the expected behavior? If so, why bother at all passing the specific type desired? Im i missing something? |
Same for getTransaction in web3_eth.d.ts returnFormat is ignored:
|
@cristianorvf this is incorrect and will be fixed. sorry for the long wait. Will create a PR |
Expected behavior
When the Number and Bytes type is passed to the typesystem it should return back the correct format desired.
Actual behavior
The object is getting the correct format, but hte typesystem is not.
Steps to reproduce the behavior
Logs
web3test.ts:10:11 - error TS2322: Type 'Bytes' is not assignable to type 'string'.
Type 'Uint8Array' is not assignable to type 'string'.
10 const hex: string = receipt.blockHash
Environment
OS: OS X VENTURA 13.4
NODE: v18.13.0
NPM: 9.6.6
TS: Version 4.9.5
The text was updated successfully, but these errors were encountered: