You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

WebAssembly交互报错can't convert 50057 to BigInt问题求助

WebAssembly接口对接BigInt转换报错问题

报错信息

Firefox DevTools控制台捕获的运行时错误如下:

Uncaught (in promise) TypeError: can't convert 50057 to BigInt

报错触发前执行的代码

static read_int(descriptor: number): number {
        console.log("read_int")
        if (descriptor < 0) {
            return -1;
        }
        let value = Wasm.readStdValue(descriptor);
        if (typeof value === 'number') {
            if (Number.isInteger(value)) {
                return value;
            }
            return Math.floor(value);
        }
        if (typeof value === 'boolean') {
            return value ? 1 : 0;
        }
        if (typeof value === 'string') {
            return parseInt(value);
        }
        return -1;
    }

问题背景

  • 本次对接的WebAssembly文件最初应用于对接Swift及WasmInterpreter库的系统
  • 代码中descriptor是作为映射表键使用的数字类型参数
  • 执行let value = Wasm.readStdValue(descriptor);行时,读取到的返回值为50057,JS侧检测到的类型为number
  • 核心疑问:50057属于数值范围很小的普通number类型,为何会触发转换为BigInt类型失败的异常

内容的提问来源于stack exchange,提问作者jimiswaytooepic

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.28 18:48:17