ts-proto 2.13.1 → 2.13.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/src/main.js CHANGED
@@ -2669,10 +2669,9 @@ function convertToObjectKey(ctx, messageDesc, field, variableName) {
2669
2669
  return (0, ts_poet_1.code) `${variableName}`;
2670
2670
  }
2671
2671
  else if ((0, types_1.isLong)(keyField) && (0, types_1.shouldGenerateJSMapType)(ctx, messageDesc, field)) {
2672
- if (ctx.options.forceLong === options_1.LongOption.LONG) {
2673
- return (0, ts_poet_1.code) `${ctx.utils.longToNumber}(${variableName})`;
2674
- }
2675
- else if (ctx.options.forceLong === options_1.LongOption.BIGINT) {
2672
+ // JSON object keys are strings, and converting a 64-bit key to a JS number
2673
+ // would lose precision (or throw, for Long) above Number.MAX_SAFE_INTEGER.
2674
+ if (ctx.options.forceLong === options_1.LongOption.LONG || ctx.options.forceLong === options_1.LongOption.BIGINT) {
2676
2675
  return (0, ts_poet_1.code) `${variableName}.toString()`;
2677
2676
  }
2678
2677
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-proto",
3
- "version": "2.13.1",
3
+ "version": "2.13.2",
4
4
  "description": "",
5
5
  "main": "build/src/plugin.js",
6
6
  "repository": "github:stephenh/ts-proto",