Skip to content

Commit 4be991e

Browse files
authored
fix: bump deno_graph to 0.108.2 for wasm multi-value return types (#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 #34065 --------- Co-authored-by: lunadogbot <lunadogbot@users.noreply.github.com>
1 parent f7de8c5 commit 4be991e

6 files changed

Lines changed: 19 additions & 3 deletions

File tree

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ deno_ast = { version = "=0.53.2", features = ["transpiling"] }
9292
deno_core_icudata = "0.77.0"
9393
deno_doc = "=0.199.0"
9494
deno_error = "=0.7.1"
95-
deno_graph = { version = "=0.108.1", default-features = false }
95+
deno_graph = { version = "=0.108.2", default-features = false }
9696
deno_lint = "=0.84.1"
9797
deno_media_type = { version = "=0.4.0", features = ["module_specifier"] }
9898
deno_native_certs = "0.3.0"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"args": "check main.ts",
3+
"output": "check.out",
4+
"exitCode": 1
5+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Check [WILDCARD]main.ts
2+
TS2322 [ERROR]: Type '[number, number]' is not assignable to type 'string'.
3+
const result: string = add_and_sub(1, 2);
4+
~~~~~~
5+
at file:///[WILDLINE]/main.ts:3:7
6+
7+
error: Type checking failed.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { add_and_sub } from "./multi_value.wasm";
2+
3+
const result: string = add_and_sub(1, 2);
4+
console.log(result);
55 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)