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

Allow to generate unions instead of TS enums in Typescript #145

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

akozhemiakin
Copy link

@akozhemiakin akozhemiakin commented Sep 27, 2023

Resolves #35

Now for unit enums, you can choose to generate a TypeScript union type instead
of a TypeScript enum.

#[typeshare(ts_union)]
pub enum UnitEnum {
    VariantA,
    VariantB,
    VariantC,
}

This would generate the following TypeScript code:

export type UnitEnum = "VariantA" | "VariantB" | "VariantC";

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

Successfully merging this pull request may close these issues.

Support for generating TypeScript union types for non-algebraic enums
1 participant