JavaScriptKit
JavaScriptKit copied to clipboard
`JSNumber` type to support `long long` type in Web API IDL
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