-
Notifications
You must be signed in to change notification settings - Fork 111
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 #[ts(as = "...")]
and #[ts(type = "...")]
on enum variants
#284
Conversation
I may need some help on the tests for this. I can't even get |
would love to take a loot at this once i find some time 👍 |
@NyxCode, I think I figured out how |
I tested my usecase from #352 and can confirm that this works as expected |
Hi @JonasFocke01, I've just fixed a merge conflict and caused a couple of compiler errors in the process, can you check if it still works? |
@gustavo-shigueo Workds still as expected 👍 |
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.
nicely done!
Goal
Add support for using
#[ts(as = "...")]
and#[ts(type = "...")]
on enum variants to make support for#[serde(with = "...")]
(#280) possible here tooChanges
#[ts(as = "...")]
and#[ts(type = "...")]
are now parsed and processed in enum variants.Using them currently respects the tag enum representation. That is, neither
#[ts(as = "...")]
nor#[ts(type = "...")]
will eliminate the "tag" or "content" properties the variant would have without them, as that can be achieved by using#[ts(untagged)]
on the variant. I don't yet know if this is how serde works, so this can be changed to maintain serde compatibilityChecklist