-
Notifications
You must be signed in to change notification settings - Fork 45
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
Cannot return Tsify types from async methods with wasm-bindgen-futures #53
Comments
The tests are failing for me locally, but I've noticed my actual issue in production occurs only when trying to return Tsify types under wasm_bindgen on async methods. For example, using use serde::{Deserialize, Serialize};
use tsify::Tsify;
use wasm_bindgen::prelude::wasm_bindgen;
#[derive(Tsify, Serialize, Deserialize)]
#[tsify(into_wasm_abi, from_wasm_abi)]
pub struct Example {
a: i32,
}
/// Compiles successfully
#[wasm_bindgen]
pub fn example_sync() -> Example {
Example { a: 42 }
}
/// Error, fails to compile
#[wasm_bindgen]
pub async fn example_async() -> Example {
Example { a: 42 }
} The sync method compiles successfully, but the async method fails to compile with the error:
|
This now appears to be a duplicate of issue #24. |
I implemented it in tsify-next fork: siefkenj#22 Should do the job let me know ! |
Thanks, man! You saved my release day |
The crate tests are failing as per below in many cases on the
js
feature which means we cannot return rust types in methods and have them automatically cast to JS objects.This is broken on both the tests on master (as per
./test.sh
) and per the deployed crate.Let me know if you're aware of a quick fix, or can point me to a likely culprit? Thanks!
The text was updated successfully, but these errors were encountered: