Skip to content
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 untagged variant #52

Open
m93a opened this issue Mar 26, 2024 · 0 comments
Open

Support untagged variant #52

m93a opened this issue Mar 26, 2024 · 0 comments

Comments

@m93a
Copy link

m93a commented Mar 26, 2024

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`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant