-
Notifications
You must be signed in to change notification settings - Fork 38
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
Add type arithmetic to improve event type-safety #705
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We did the same at contract level in dex-js 😁
I wonder if it makes sense to centralize the types somewhere
@Velenir I actually stole some of it from your implementation, but I didn't get a discriminated union for the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very cool. Is this something that could be included upstream in the package that creates types for the contracts/web3 ?
Probably! I created #706 so we don't forget. |
This PR just adds some utility types that improve type-safety on event types. They are currently not used, but I figured that it was worth including it in a separate PR since it is rather dense code that takes some time to get used to.
Test Plan
Example of it in action:
Produces the folling
tsc
errors: