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
Exported log type declaration is not complete, the "args" param is not defined and i need to trick with type declaration to avoid ts errors witch is not really good practice.
am i missing something or is it a incomplete type declaration ?
import{Log}from'viem';functionprocessLog(log: Log){returnlog.args// error here, no type declaration};
if it can help, did a type to convert log signature to args, maybe it could be useful in the Log type ?
import{ParseAbiItem,AbiParametersToPrimitiveTypes,AbiParameter}from'abitype';import{EventSignature}from"abitype/dist/types/human-readable/types/signatures";/** * Convert the signature to ABI type with `ParseAbiItem` and extract the inputs as `AbiParameter[]`. * So the returned type can be used in `AbiParametersToPrimitiveTypes`. */typeEventAbiInputs<signatureextendsEventSignature>=ParseAbiItem<signature>extends{inputs: infer Inputs} ?
InputsextendsreadonlyAbiParameter[] ? Inputs : never
: never;/** * Not necessary but more readable, it just wrap the `AbiParametersToPrimitiveTypes` with the previous type `EventAbiInputs`. */typeEventArgsTypes<signatureextendsEventSignature>=AbiParametersToPrimitiveTypes<EventAbiInputs<signature>>;/** * Create the object using both EventAbiInputs for keys and the converted types for values. */typeEventArgs<signatureextendsEventSignature>={[KinEventAbiInputs<signature>[number]['name']]: EventArgsTypes<signature>[number]}/*** Fixed "Log" type*/typeLog<signatureextendsEventSignature>=Log&{args: EventArgs<signature>}
What is the type of issue?
Documentation is missing
What is the issue?
Exported log type declaration is not complete, the "args" param is not defined and i need to trick with type declaration to avoid ts errors witch is not really good practice.
am i missing something or is it a incomplete type declaration ?
if it can help, did a type to convert log signature to args, maybe it could be useful in the Log type ?
Where did you find it?
https://github.com/wevm/viem/blob/main/src/types/log.ts
Reproduce
The text was updated successfully, but these errors were encountered: