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

Support for generating Typescript types for events #2050

Closed
mcintyre94 opened this issue Jul 11, 2022 · 1 comment
Closed

Support for generating Typescript types for events #2050

mcintyre94 opened this issue Jul 11, 2022 · 1 comment
Labels

Comments

@mcintyre94
Copy link
Contributor

Currently, given an IDL type IDL we can derive Typescript types for its accounts using eg. IdlAccounts<IDL>['pixel']

There doesn't seem to be an equivalent for event types. It'd be useful to have this so that we can use this type in event handling code on the client without manually re-writing the types.

It seems that the IDL behaviour is similar to accounts, and we already have TS-friendly field names. So I think it'd just be a case of adding a similar utility type to IdlAccounts<IDL> that can handle events.

@acheroncrypto
Copy link
Collaborator

IdlEvents type was added in #2185 .

Related: Program.addEventListener is now strongly typed(#2627).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants