ts-proto 1.83.1 → 1.83.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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [1.83.2](https://github.com/stephenh/ts-proto/compare/v1.83.1...v1.83.2) (2021-10-26)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Add missing defaults to fromPartial if options.oneof is UNIONS ([#375](https://github.com/stephenh/ts-proto/issues/375)) ([21781e9](https://github.com/stephenh/ts-proto/commit/21781e98bb6117b540be8c3f2c38ac3ad5cbbb44))
7
+
1
8
  ## [1.83.1](https://github.com/stephenh/ts-proto/compare/v1.83.0...v1.83.1) (2021-09-17)
2
9
 
3
10
 
package/build/main.js CHANGED
@@ -1082,7 +1082,7 @@ function generateFromPartial(ctx, fullName, messageDesc) {
1082
1082
  chunks.push(ts_poet_1.code `message.${fieldName} = ${readSnippet(`object.${fieldName}`)};`);
1083
1083
  }
1084
1084
  }
1085
- if (!types_1.isRepeated(field) && options.oneof !== options_1.OneofOption.UNIONS) {
1085
+ if (!types_1.isRepeated(field) && !types_1.isWithinOneOfThatShouldBeUnion(options, field)) {
1086
1086
  chunks.push(ts_poet_1.code `} else {`);
1087
1087
  const v = types_1.isWithinOneOf(field) ? 'undefined' : types_1.defaultValue(ctx, field);
1088
1088
  chunks.push(ts_poet_1.code `message.${fieldName} = ${v}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-proto",
3
- "version": "1.83.1",
3
+ "version": "1.83.2",
4
4
  "description": "",
5
5
  "main": "build/plugin.js",
6
6
  "repository": "github:stephenh/ts-proto",