Skip to content

Support untagged variant #52

@cshaa

Description

@cshaa

Serde supports untagged enum variants (added in this PR):

#[derive(Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub enum Foo {
  Bar,
  Qux,
  #[serde(untagged)]
  Other(f64),
}

This should result in the following TS type:

export type Foo = "bar" | "qux" | number;

However, if you add Tsify to the derive clause, you get an error instead:

unknown serde variant attribute `untagged`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions