You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When creating bindings to a function with a u64 return value, the returned value is assumed to be of type BigInt in the generated bindings. It seems like it would be possible to get Number values containing integers between 2^32 and 2^53-1 as an integer type directly in the bindings, but it doesn't appear to be possible currently.
I couldn't find any documentation explicitly saying "use f64 if you want integers over u32 and convert on the Rust side if you need, it's the same size anyway" (I may have just missed it), but that seems to be the approach that's been taken eg for Date.now() in js_sys.
Steps to Reproduce
Create a simple alternative binding to Date.now() expecting a u64 and a test that calls it:
Describe the Bug
When creating bindings to a function with a
u64
return value, the returned value is assumed to be of typeBigInt
in the generated bindings. It seems like it would be possible to getNumber
values containing integers between 2^32 and 2^53-1 as an integer type directly in the bindings, but it doesn't appear to be possible currently.I couldn't find any documentation explicitly saying "use f64 if you want integers over u32 and convert on the Rust side if you need, it's the same size anyway" (I may have just missed it), but that seems to be the approach that's been taken eg for
Date.now()
in js_sys.Steps to Reproduce
Date.now()
expecting au64
and a test that calls it:wasm-pack test --node
Expected Behavior
A binding is produced that can handle a
Number
orBigInt
return valueActual Behavior
Test fails with
The text was updated successfully, but these errors were encountered: