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
{{ message }}
Repository navigation
Allow configuration to choose BigInt over Long.js for int64 types #3047
Is your feature request related to a problem? Please describe.
Inability to configure parsing int64 types to BigInt over Long.js or String - .
Describe the solution you'd like
At the moment the choices for when we can handle int64/uint64 types are only Long or String - Now with the ES2020 inclusion of BigInt which is much more compatible and doesn't rely on a third party package. We're also using ts-proto to codegen values and they give us the option but unfortunately it's not available on this library AFAIK.
Describe alternatives you've considered
We can use strings or Long.js but for us it makes much more sense in our use case to maintain using the Number type and using the BigInt option for us as it's much more futureproof.
Additional context
We're using Nest.js here with these package versions:
The @grpc/proto-loader library is a fairly thin wrapper around the protobufjs library, and that's what controls this behavior. Unfortunately, the PR to add that functionality there (protobufjs/protobuf.js#1908) has been open for 3 years without any response.
On the protobuf.js side, this is partly covered by protobufjs/protobuf.js#2257 (feat: Support BigInt conversions) and also backported to 7.x: fromObject can accept BigInt input, and toObject supports { longs: BigInt }. To maintain compatibility, this does not switch the runtime representation itself to BigInt yet. Changing the internal representation is left for protobuf.js 9.x.
Activity
murgatroid99 commentedon Apr 14, 2026
The
@grpc/proto-loaderlibrary is a fairly thin wrapper around theprotobufjslibrary, and that's what controls this behavior. Unfortunately, the PR to add that functionality there (protobufjs/protobuf.js#1908) has been open for 3 years without any response.dcodeIO commentedon May 22, 2026
On the protobuf.js side, this is partly covered by protobufjs/protobuf.js#2257 (
feat: Support BigInt conversions) and also backported to 7.x:fromObjectcan accept BigInt input, andtoObjectsupports{ longs: BigInt }. To maintain compatibility, this does not switch the runtime representation itself to BigInt yet. Changing the internal representation is left for protobuf.js 9.x.brzosthub commentedon Aug 11, 2026
Hey team. I've created mr to fix that: FIX
feat(proto-loader): support longs: BigInt for int64 fields