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

BigInt in node.js #1151

Open
j3bb9z opened this issue Dec 19, 2018 · 5 comments
Open

BigInt in node.js #1151

j3bb9z opened this issue Dec 19, 2018 · 5 comments

Comments

@j3bb9z
Copy link

j3bb9z commented Dec 19, 2018

Hi,

New versions of Node.js (10.4.0+) have BigInt support.

Just wanted to ask - are you going to make use of it?

@Cryrivers
Copy link

Would like to highlight that TypeScript also supports bigint with the feature flag enabled. So do please consider supporting bigint in TypeScript declaration as well.

@gerardmrk
Copy link

Unable to assign the return value of process.hrtime.bigint() to the protobuf type of uint64 as well. the generated type for uint64 is number|Long|null.

@betamos
Copy link

betamos commented Oct 27, 2019

Noticed a couple of issues, this was in a node v12.13.0 environment:

  1. Encoding from a BigInt (which fits) to a uint64 field results in a Long with the value 0. This is dangerous.
  2. Encoding from a BigInt (which fits) to a uint32 field results in a crash: TypeError: Cannot mix BigInt and other types, use explicit conversions.
  3. If Long adds support for BigInt, (1) might be fixed as a side-effect.

@mjgp2
Copy link

mjgp2 commented Mar 9, 2021

I opened a PR if you have comments - #1557

@mahnunchik
Copy link

Year 2023, BigInt supported by 95.14% of browsers https://caniuse.com/bigint

Can we have landed native BigInt to protobuf.js?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants