optional BigInt support: map BigInt to int64/uint64 when useBigInt64 is set to true#223
optional BigInt support: map BigInt to int64/uint64 when useBigInt64 is set to true#223
useBigInt64 is set to true#223Conversation
Codecov ReportPatch coverage:
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more Additional details and impacted files@@ Coverage Diff @@
## main #223 +/- ##
==========================================
+ Coverage 98.31% 98.38% +0.06%
==========================================
Files 16 16
Lines 952 990 +38
Branches 193 202 +9
==========================================
+ Hits 936 974 +38
Misses 16 16
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
|
Hi @gfx, thank you for working on this feature. For the most part it looks good but I wanted to point out one design issue. I see that you made the deliberate choice to encode and decode For example, if I encode I say this because it's common for JavaScript msgpack code to be used in conjunction with components written in other languages, which don't have the same I understand your reluctance to enable this behavior by default, since as you pointed out |
This PR introduces a new option
useBigInt64: boolean, which enables "bigint mode" in this library.Unfortunately, the bigint-mode handles JavaScript numbers completely differently than non-bigint-mode. The following table describes the type mappings.
Because JavaScript's
bigintis not calculable withnumber, they should not be mixed. A field that is a bigint must always be a bigint even if it's encoded and decoded by this library.The default value of the option will be changed to true in a future major upgrade. Not sure when I'll do it so far.
ref. #115