Skip to content

[Web API type definition issue] Wasm64 Support #2485

Open

Description

@daxpedda

Summary

WebAssembly.AddressValue should be number | bigint instead of number

Expected vs. Actual Behavior

There are a bunch of APIs relying on the type definition of WebAssembly.AddressValue:

  • WebAssembly.Memory.grow()
  • WebAssembly.Table.*
  • `WebAssembly.MemoryDescriptor.*
  • WebAssembly.TableDescriptor.*

With Wasm64 memory and tables can be 64-bit, requiring some of the parameters and properties to be bigint instead of number. Currently AddressValue is defines as number, but it should be number | bigint instead.

Maybe the API could be further improved with a separate table or memory type, in which the constructor with the help of WebAssembly.MemoryDescriptor or WebAssembly.TableDescriptor can determine which type we are dealing with.

Playground Link

No response

Browser Support

  • This API is supported in at least two major browser engines (not two Chromium-based browsers).

Have Tried The Latest Releases

  • This issue applies to the latest release of TypeScript.
  • This issue applies to the latest release of @types/web.

Additional Context

This has been explicitly overwritten internally here.

Activity

  1. MartinFerret commented on Dec 1, 2026

    @MartinFerret
    Contributor

    Kagami Sascha Rosylight (@saschanaz) I'd like to take this one. :)

    I checked it with TypeScript 7.0.2 and Chromium 158: a 64-bit memory or table needs bigints at runtime, but the types only accept numbers, so valid code doesn't compile.

    The override comment mentions es2015 compat, but bigint is already used elsewhere in the WebAssembly types and still compiles with TypeScript 5.5.4 on old targets. What would actually break is existing 32-bit code doing math on grow()'s result.

    So I propose we keep number by default and only switch to bigint when the descriptor says address: "i64", the same way #2592 handles shared.

    What do you think about that approach?

  2. saschanaz commented on Dec 1, 2026

    @saschanaz
    Contributor

    Sound good 👀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions