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
feat: exclusive enum type inference in typegen #2146
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.
How come this PR is closing #1891?
AFAIU, the API will still be:
await contract.functions.new_game({ Address: { value: walletAddress });
await contract.functions.new_game({ ContractId: { value: contractId });
Instead of:
await contract.functions.new_game({ address: walletAddress });
await contract.functions.new_game({ contractId: contractId });
@arboleya Oof, good catch. Converting to draft. Got a bit elated with the new generic behavior and forgot about that 😅 |
@arboleya Actually, we can treat this PR as a pre-step that can be merged as-is because it touches upon all enums, not just |
Co-authored-by: Peter Smith <peter@blueoceancomputing.co.uk>
Coverage Report:
Changed Files:Coverage values did not change👌. |
This PR adds better type inference for all typegen enums. Now, if you provide one property of an enum, you can't provide the other ones. Here's the change in a nutshell: playground.
This PR is a step towards resolving #1891, but I set it as a separate PR because it touches upon enum type inference generally, not just the
Identity
enum. As @danielbate alluded to here, there's no reason to not apply the same type inference for all enums.