ts-rs
ts-rs copied to clipboard
Is it possible to generate numeric enums?
Hi. thanks for this awesome library!
Is it possible to generate numeric enums in typescript from my rust enums?
#[derive(Serialize, Deserialize, TS, Debug)]
#[serde(rename_all = "camelCase")]
#[ts(export, export_to = "../src/types/interfaces/")]
pub enum PlotType {
Display = 0,
Extents = 1,
Limits = 2,
View = 3,
Window = 4,
Layout = 5,
}
becomes
export type PlotType = "display" | "extents" | "limits" | "view" | "window" | "layout";
I would expect it to become something like
export const enum PlotType = {
Display = 0,
Extents = 1,
Limits = 2,
View = 3,
Window = 4,
Layout = 5,
}
Is this possible?