You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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,
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:
exportenumErrorCode{FooError=0,BarError=2,}
The text was updated successfully, but these errors were encountered:
👍 This is really important as otherwise it can lead to subtle bugs when using the literal value of the enum.
In particular, non initialized enum in the typescript declaration file generated by wasm_bindgen will be computed. This all prevents the use of the enum variants in type declarations.
Liamolucko
added a commit
to Liamolucko/wasm-bindgen
that referenced
this issue
Jan 14, 2023
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,is converted to the following code:
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:
The text was updated successfully, but these errors were encountered: