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
protobuf-ts has an option to use Number to represent int64 fields which is often very convenient where int32 2^32 size is not enough to represent a value, but Javascript's MAX_SAFE_INTEGER (2^53) certainly is.
In my case, this happens when dealing with accounting and money.
The text was updated successfully, but these errors were encountered:
Hi, @pzeinlinger. Sorry for the delay. It was actually a conscious decision to not allow this. I see your point, but it's obviously only effective if you can guarantee that no number in that field will ever exceed JavaScript's MAX_SAFE_INTEGER. This may be the case in your scenario, but it could lead to others encountering subtle bugs. Can you provide more detail on why an int64 doesn't meet your needs?
This is somewhat disappointing since I was hoping to use this for a field that is used for "millis since epoch" in our schemas.
Having to roundtrip these values via BigInt is a performance concern.
And yes, millis since epoch is number safe given Date#getTime has that particular return type for the same domain.
protobuf-ts has an option to use Number to represent int64 fields which is often very convenient where int32 2^32 size is not enough to represent a value, but Javascript's MAX_SAFE_INTEGER (2^53) certainly is.
In my case, this happens when dealing with accounting and money.
The text was updated successfully, but these errors were encountered: