Hi there! I am working with wit-bindgen, wasm-tools and jco. Now everything works fine, until I introduce this interface to my wit file:
interface imports {
enum fetch-text-error {
io-error,
http-error,
}
fetch-text: async func(location: string) -> result<string, fetch-text-error>;
}
I generate a wasm component like this:
wasm-tools component new --output target/wasm32-unknown-unknown/release/jns42_core.component.wasm target/wasm32-unknown-unknown/release/jns42_core.wasm
Then I generate the js/ts code like this:
> jco transpile --instantiation async --out-dir dist $npm_config_local_prefix/target/wasm32-unknown-unknown/release/jns42_core.component.wasm
Wich results in:
(jco transpile) ComponentError: failed to extract interface information from component
Caused by:
type mismatch for export `0` of module instantiation argument ``
expected: (func (param i32 i32 i32) (result i32))
found: (func (param i32 i32) (result i32)) (at offset 0x31aaaa)
Now I assume that the async function in the interface is causing the problems, because if i remove the async keyword everything works fine. So I guess we have a bug!
Now I assume the bug is either in wasm-tools or in jco. I would love to find it, and then set it free into nature so we are not bothered by it anymore. But in order to do that I first need to find it.
I am not too familiar with wasm-tools and or jco (not yet!) and not sure where to look first. So, I have a few questions that might help me get up too speed!
Thanks in advance for the tips! I will be digging around in the wasm-tools / jco project in the meanwhile!
Have a nice evening!
Last updated: Dec 06 2025 at 07:03 UTC