swiftwasm / swiftwasm/JavaScriptKit

`JSNumber` type to support `long long` type in Web API IDL

未关闭
#194 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

enhancement
主要语言
Swift
星标
986
派生
76
平均合并
21 小时 11 分钟
30 天内合并 PR
4

描述

Rust folks have a similar issue, where long long shouldn't be mapped to Int64, which is bridged to BigInt on JS side. https://github.com/rustwasm/wasm-bindgen/issues/800

Checked a few other places where long long is used, like AudioData, Blob, and File and all of them return a JS number in corresponding properties, not BigInt. I'm 95% sure none of these support BigInt, remaining 5% certainty could be added by writing actual tests. I personally vote for either keeping these Int32 as proposed, or creating a new union type. Just riffing:

enum JSNumber: ExpressibleByIntegerLiteral, ExpressibleByFloatLiteral {
case integer(Int32)
case float(Double)
// ...
}

Should we add such type to JSKit then?

cc @kateinoigakukun

Originally posted by @MaxDesiatov in https://github.com/swiftwasm/WebAPIKit/issues/42#issuecomment-1125355976

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先检查 JSKit 对 Web API IDL long long 值的处理方式,并将 issue 中提到的 AudioData、Blob 和 File 属性与 wasm-bindgen issue 800 进行比较。要视为完成,需要确定 JavaScript 数字的表示方式,并通过测试确认这些属性是否支持 BigInt;没有指定实现文件或测试。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript, swift, wasm
领域
api, web-dev
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。