-
Notifications
You must be signed in to change notification settings - Fork 10
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
Enums with custom types #25
Comments
hey @RandyMarsh1, thanks for reporting this :) Let me know if 1.7.0 doesn't work for you. I think eventually what we'll want to do is namespace a lot of this output. Closing this for now, feel free to re-open it |
Thanks, nested structs within structs now works, this is a great improvement 👍 However the specific scenario I was hoping for was Rust Enums that take a struct of the same name as input parameter like this:
This currently does not output anything and is skipped. The following does output a type but the variants are Strings, not Interfaces.
This admittable requires a somewhat opinionated structure but I think is a nice clean way of generating JSON with the Enum variant as key and Struct as Value. The Example code in original post should compile and demonstrates the use case. |
Ah that should be possible too -- do you mind lending me a hand with this one?
|
Is it possible to have Enum variants that take a self named struct parameter and output as types?
The ideal output:
type Message = | MyStruct1 | MyStruct2;
where the structs are types, not strings.
This would allow easy structuring of JSON in Rust and Destructing in TypeScript, Example:
The text was updated successfully, but these errors were encountered: