ts-proto 2.8.2 → 2.8.3
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.
|
@@ -201,7 +201,7 @@ function generateWrapShallow(ctx, fullProtoTypeName, fieldNames) {
|
|
|
201
201
|
chunks.push((0, ts_poet_1.code) `wrap(value: any): ${(0, utils_1.wrapTypeName)(ctx.options, "Value")} {
|
|
202
202
|
const result = createBase${(0, utils_1.wrapTypeName)(ctx.options, "Value")}()${maybeAsAny(ctx.options)};
|
|
203
203
|
if (value === null) {
|
|
204
|
-
result.kind = {$case: '${fieldNames.nullValue}', value };
|
|
204
|
+
result.kind = {$case: '${fieldNames.nullValue}', value: ${(0, utils_1.wrapTypeName)(ctx.options, "NullValue")}.NULL_VALUE};
|
|
205
205
|
} else if (typeof value === 'boolean') {
|
|
206
206
|
result.kind = {$case: '${fieldNames.boolValue}', value };
|
|
207
207
|
} else if (typeof value === 'number') {
|
|
@@ -310,7 +310,7 @@ function generateUnwrapShallow(ctx, fullProtoTypeName, fieldNames) {
|
|
|
310
310
|
}
|
|
311
311
|
else if (ctx.options.oneof === options_1.OneofOption.UNIONS_VALUE) {
|
|
312
312
|
chunks.push((0, ts_poet_1.code) `unwrap(message: ${(0, utils_1.wrapTypeName)(ctx.options, "Value")}): string | number | boolean | Object | null | Array<any> | undefined {
|
|
313
|
-
return message.kind?.value;
|
|
313
|
+
return (message.kind?.$case === '${fieldNames.nullValue}') ? null : message.kind?.value;
|
|
314
314
|
}`);
|
|
315
315
|
}
|
|
316
316
|
else {
|