ts-proto 1.159.0 → 1.159.1
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/main.js +6 -0
- package/build/types.js +2 -1
- package/package.json +1 -1
package/build/main.js
CHANGED
|
@@ -1995,6 +1995,9 @@ function convertFromObjectKey(ctx, messageDesc, field, variableName) {
|
|
|
1995
1995
|
return (0, ts_poet_1.code) `${ctx.utils.globalThis}.Number(${variableName})`;
|
|
1996
1996
|
}
|
|
1997
1997
|
}
|
|
1998
|
+
else if (keyField.type === ts_proto_descriptors_1.FieldDescriptorProto_Type.TYPE_BOOL) {
|
|
1999
|
+
return (0, ts_poet_1.code) `${ctx.utils.globalThis}.Boolean(${variableName})`;
|
|
2000
|
+
}
|
|
1998
2001
|
else {
|
|
1999
2002
|
return (0, ts_poet_1.code) `${ctx.utils.globalThis}.Number(${variableName})`;
|
|
2000
2003
|
}
|
|
@@ -2015,6 +2018,9 @@ function convertToObjectKey(ctx, messageDesc, field, variableName) {
|
|
|
2015
2018
|
return (0, ts_poet_1.code) `${variableName}`;
|
|
2016
2019
|
}
|
|
2017
2020
|
}
|
|
2021
|
+
else if (keyField.type === ts_proto_descriptors_1.FieldDescriptorProto_Type.TYPE_BOOL) {
|
|
2022
|
+
return (0, ts_poet_1.code) `${ctx.utils.globalThis}.String(${variableName})`;
|
|
2023
|
+
}
|
|
2018
2024
|
else {
|
|
2019
2025
|
return (0, ts_poet_1.code) `${variableName}`;
|
|
2020
2026
|
}
|
package/build/types.js
CHANGED
|
@@ -642,7 +642,8 @@ function shouldGenerateJSMapType(ctx, message, field) {
|
|
|
642
642
|
if (!mapType) {
|
|
643
643
|
return false;
|
|
644
644
|
}
|
|
645
|
-
return
|
|
645
|
+
return (mapType.keyField.type === ts_proto_descriptors_1.FieldDescriptorProto_Type.TYPE_BOOL ||
|
|
646
|
+
(isLong(mapType.keyField) && ctx.options.forceLong === options_1.LongOption.LONG));
|
|
646
647
|
}
|
|
647
648
|
exports.shouldGenerateJSMapType = shouldGenerateJSMapType;
|
|
648
649
|
function detectMapType(ctx, messageDesc, fieldDesc) {
|