Skip to content

[js-api] Accept anyref and funcref in ValueType and TableKind - #2239

Open
chicoxyzzy wants to merge 1 commit into
WebAssembly:mainfrom
chicoxyzzy:js-api-anyref-funcref
Open

[js-api] Accept anyref and funcref in ValueType and TableKind#2239
chicoxyzzy wants to merge 1 commit into
WebAssembly:mainfrom
chicoxyzzy:js-api-anyref-funcref

Conversation

@chicoxyzzy

@chicoxyzzy chicoxyzzy commented Sep 1, 2026

Copy link
Copy Markdown
Member

Fixes #1980.

Add the GC top type "anyref" and "funcref" as an alias of "anyfunc" to the JS API string enums. That matches the last comment on the issue. Accept anyref and funcref now. Do not add i31ref, eqref, structref, or arrayref. Do not add null bottoms. Do not add exnref.

DefaultValue for anyref is val_default (ref.null any → JS null). That is not the externref default (undefined).

ToWebAssemblyValue is unchanged. An anyref global can be defaulted or set to null, an i31, or an exported GC object. A plain JS object still fails the match_valtype check (host refs are extern, not any).

Fixes WebAssembly#1980.

Add the GC top type "anyref" and "funcref" as an alias of "anyfunc".
Do not add i31ref, eqref, structref, arrayref, null bottoms, or exnref.

DefaultValue for anyref is val_default (ref.null any, JS null), not the
externref default (undefined).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[js-api] Are Wasm-gc abstract heap types included in the JS API of e.g. WebAssembly.Global?

1 participant