swiftwasm / swiftwasm/JavaScriptKit
`JSNumber` type to support `long long` type in Web API IDL
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 986
- Forks
- 76
- Avg merge
- 21h 11m
- Merged PRs (30d)
- 4
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing JSKit's handling of Web API IDL long long values and compare the AudioData, Blob, and File properties mentioned in the issue with wasm-bindgen issue 800. Done would require a decided representation for JavaScript numbers, along with tests confirming whether these properties support BigInt; no implementation file or test is named.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, swift, wasm
- Domain
- api, web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100