Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support BigInt in TypeScript runtime #113

Open
arendjr opened this issue May 6, 2022 · 3 comments
Open

Support BigInt in TypeScript runtime #113

arendjr opened this issue May 6, 2022 · 3 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@arendjr
Copy link
Contributor

arendjr commented May 6, 2022

The TypeScript runtime currently has limited support for integers larger than 2^53-1. bigint types are used when passing u64 WASM primitives, but when they’re passed as part of a MessagePack-encoded structure, they will always use number, causing precision to be lost for larger numbers.

Recently a new PR for msgpack-js made it possible to use bigint with MessagePack as well: msgpack/msgpack-javascript#211

I think it makes sense for us to implement an opt-in option with a similar effect.

@arendjr arendjr added the enhancement New feature or request label May 6, 2022
@arendjr arendjr added the good first issue Good for newcomers label Jun 21, 2022
@sagacity
Copy link
Contributor

Initial investigation indicates that the current way of dealing with large numbers in msgpack-javascript is by encoding them as strings, which isn't great. Let's (briefly) see if the PR mentioned by @arendjr will be merged. If not we can either choose to fork msgpack-javascript (or use the PR branch) or deal with large-numbers-as-strings on the Rust side of fp-bindgen.

@arendjr
Copy link
Contributor Author

arendjr commented Jan 16, 2023

With a bit of luck, we might be able to include this in our own 3.0 release as well: msgpack/msgpack-javascript#211 (comment)

Might even be worthwhile to wait a bit for this (assuming it's not too long), as proper BigInt support would likely be a breaking change on our side as well.

@arendjr
Copy link
Contributor Author

arendjr commented Feb 14, 2023

Unfortunately, their PR is still open, so we should go ahead with our 3.0 release without this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants