typeshare
typeshare copied to clipboard
Figure out how to handle scenarios where enum variants contain data types with the same name
If we have an enum that contains a data type with an identical name, the generated code will be ambiguous and throw errors.
Here's an example of code that would cause this problem.
#[typeshare]
struct Variant {}
#[typeshare]
#[serde(tag ="type", content ="content")]
pub enum MyEnum {
Variant(Variant),
}
One potential workaround is creating type-aliases to resolve the ambiguous typing, but this solution needs further exploration to ensure we won't create further naming conflicts by accident.
Maybe you can use config as well?
[typescript.type_mappings]
"Variant" = "AnotherName"
Would that not work?