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
I'm getting the next error wehen trying to compile an enum with an impl
error: cannot shadow already defined class 'Foo' Error: Running the wasm-bindgen CLI Caused by: Running the wasm-bindgen CLI Caused by: failed to execute 'wasm-bindgen': exited with exit status: 1
like this:
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub enum Foo {
A,
B
}
#[wasm_bindgen]
impl Foo {
pub fn from(f: usize) -> Option<Foo> {
match f {
0 => Some(Foo::A),
1 => Some(Foo::B),
_ => None
}
}
}
wasm-pack version: 0.11.0
rustc version: 1.69.0
Regards!
The text was updated successfully, but these errors were encountered:
I believe this isn't an issue inherent in wasm-pack, but instead the underlying wasm-bindgen ? It's got to do with enums in Typescript not supporting methods. Related issue here: rustwasm/wasm-bindgen#1715, which seems to suggest exporting regular functions instead of methods.
Hello everybody!
I'm getting the next error wehen trying to compile an
enum
with animpl
error: cannot shadow already defined class 'Foo' Error: Running the wasm-bindgen CLI Caused by: Running the wasm-bindgen CLI Caused by: failed to execute 'wasm-bindgen': exited with exit status: 1
like this:
wasm-pack version: 0.11.0
rustc version: 1.69.0
Regards!
The text was updated successfully, but these errors were encountered: