-
Notifications
You must be signed in to change notification settings - Fork 118
Open
Description
First of all, thank you for this great crate. I use it a lot in my project (for which I made a fork and implemented rescript support, probably not complete).
In rescript all types inside a module need to be topologically sorted by dependency.
I expanded on the snapshot test orders_types with the following.
Purposefully named such that BEnum should be declared before AEnum after sorting.
#[typeshare]
#[serde(rename_all = "camelCase", tag = "type", content = "data")]
pub enum AEnum {
Variant1(BEnum),
Variant2(f32),
}
#[typeshare]
#[serde(rename_all = "camelCase")]
pub enum BEnum {
Var1,
Var2,
}Expected
type bEnum = | @as("var1") var1 | @as("var2") var2
@tag("type")
type aEnum =
| @as("variant1") variant1({data: bEnum})
| @as("variant2") variant2({data: float})Actual
@tag("type")
type aEnum =
| @as("variant1") variant1({data: bEnum})
| @as("variant2") variant2({data: float})
type bEnum = | @as("var1") var1 | @as("var2") var2If I reverse the names of the types the output is correct. So I guess they are sorted alphabetically beforehand.
I guess kotlin is also terse with enum output so you could verify there.
Metadata
Metadata
Assignees
Labels
No labels