Repository navigation
fix(graph): bump deno_graph to 0.108.2 for wasm multi-value return types - #34070
Merged
Merged
Conversation
Picks up denoland/deno_graph#644, which fixes `wasm_module_to_dts` so WebAssembly exports with multiple return values (e.g. `(result i32 i32)`) produce a tuple TypeScript return type (`[number, number]`) instead of collapsing to a single `number`. Fixes #34065
Member
|
@lunadogbot can you add a test for this wasm feature? Place it next to other wasm import tests |
Adds tests/specs/check/wasm_multi_value/ which type-checks a TS file importing a wasm function whose signature has multiple return values. The wasm module exports `add_and_sub(i32, i32) -> (i32, i32)`; the generated TypeScript declaration must use the tuple return type `[number, number]` rather than collapsing to `number`.
Contributor
Author
|
Added a spec test in |
littledivy
pushed a commit
to crowlKats/deno
that referenced
this pull request
Jun 10, 2026
…noland#34070) Bumps `deno_graph` from `=0.108.1` to `=0.108.2`. Without this fix, importing a WebAssembly function whose signature has multiple return values (e.g. `(result i32 i32)`) generates a TypeScript declaration whose return type collapses to a single `number` instead of the expected tuple `[number, number]`, so `deno check` reports an incorrect type. Reproduction from the upstream issue: ```sh mkdir /tmp/wasm-multi-value && cd /tmp/wasm-multi-value deno run --allow-read --allow-write --allow-env - <<'JS' import wabtMod from "npm:wabt@1.0.36"; const wabt = await wabtMod(); const wat = `(module (func $add_and_sub (param $a i32) (param $b i32) (result i32 i32) local.get $a local.get $b i32.add local.get $a local.get $b i32.sub) (export "add_and_sub" (func $add_and_sub)))`; const mod = wabt.parseWat("t.wat", wat, { multi_value: true }); await Deno.writeFile("test.wasm", mod.toBinary({}).buffer); JS cat > test.ts <<'TS' import { add_and_sub } from "./test.wasm"; const r: "expected-tuple" = add_and_sub(1, 2); TS ./target/debug/deno check test.ts ``` With this PR, the inferred return type is now `[number, number]` rather than `number`. Fixes denoland#34065 --------- Co-authored-by: lunadogbot <lunadogbot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Bumps
deno_graphfrom=0.108.1to=0.108.2, which picks updenoland/deno_graph#644
("fix: support wasm multi-value types").
Without this fix, importing a WebAssembly function whose signature has multiple
return values (e.g.
(result i32 i32)) generates a TypeScript declaration whosereturn type collapses to a single
numberinstead of the expected tuple[number, number], sodeno checkreports an incorrect type.Changes
Cargo.toml:deno_graph = { version = "=0.108.2", default-features = false }Cargo.lock: refreshed viacargo update -p deno_graphNo other workspace crate pins
deno_graphdirectly. The 0.108.1 to 0.108.2 diffis a one-file fix to
src/source/wasm.rsplus test fixture updates and does notchange the public API, so no source changes are needed in this repo. The wasm
multi-value behavior is already covered by tests in
deno_graphitself.Verification
cargo check --bin denopasses cleanly against the new release.Reproduction from the upstream issue:
With this PR, the inferred return type is now
[number, number]rather thannumber.Fixes #34065
Closes bartlomieju/orchid-inbox#81