Closed
Description
Motivation
wasm_bindgen
macro supports C-style enums. It supports specifying literal values for each enum variant, but it seems that those values are not included in the generated d.ts file. For example,
#[wasm_bindgen]
pub enum ErrorCode {
FooError = 0,
BarError = 2,
}
is converted to the following code:
export enum ErrorCode {
FooError,
BarError,
}
Specifying the actual values of enum lets us use more features in typescript, so it would be nice if the corresponding literal values are included in d.ts.
Proposed Solution
The ideal solution would give us the following typescript code:
export enum ErrorCode {
FooError = 0,
BarError = 2,
}
Metadata
Metadata
Assignees
Labels
No labels