Skip to content
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

Log type miss "args" property #3186

Closed
iyarsius opened this issue Jan 6, 2025 · 2 comments
Closed

Log type miss "args" property #3186

iyarsius opened this issue Jan 6, 2025 · 2 comments
Labels
A: Docs Area: Documentation

Comments

@iyarsius
Copy link

iyarsius commented Jan 6, 2025

What is the type of issue?

Documentation is incorrect

What is the issue?

When i use the public client "getLogs" method, each log contain a property called "args" witch contain the value emitted from the log.

to reproduce:

const logs = await public.getLogs({ blockHash: "anyHash", event: parseAbiItem("event ...") });

logs[0].args // type error

But in the returned type "Log", the "args" property is not mentionned, so i have to trick with types declarations to use it.

typing it should be feasible since the eventAbi contain the keys values and also provide the type.

So i suggest something like:

type Log {
  // ... current type
  args: // a type generated from the abi provided or at least "any" if it's not possible
}

I didnt made a PR since your types are pretty complex and i dont want to make misstakes.

Where did you find it?

https://github.com/wevm/viem/blob/main/src/types/log.ts

@iyarsius iyarsius added the A: Docs Area: Documentation label Jan 6, 2025
@jxom
Copy link
Member

jxom commented Jan 6, 2025

Can you please break this TypeScript Playground and open a new issue with the error? I managed to get inferred types on args.

@jxom jxom closed this as not planned Won't fix, can't repro, duplicate, stale Jan 6, 2025
Copy link
Contributor

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A: Docs Area: Documentation
Projects
None yet
Development

No branches or pull requests

2 participants