Skip to content

Commit

Permalink
V2: Change return type of merge functions (#867)
Browse files Browse the repository at this point in the history
  • Loading branch information
timostamm authored Jun 3, 2024
1 parent ab40533 commit 01045de
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
3 changes: 1 addition & 2 deletions packages/protobuf/src/from-binary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,14 @@ export function mergeFromBinary<Desc extends DescMessage>(
target: MessageShape<Desc>,
bytes: Uint8Array,
options?: Partial<BinaryReadOptions>,
): MessageShape<Desc> {
): void {
readMessage(
reflect(messageDesc, target),
new BinaryReader(bytes),
makeReadOptions(options),
false,
bytes.byteLength,
);
return target;
}

/**
Expand Down
7 changes: 3 additions & 4 deletions packages/protobuf/src/from-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ export function mergeFromJsonString<Desc extends DescMessage>(
target: MessageShape<Desc>,
json: string,
options?: Partial<JsonReadOptions>,
): MessageShape<Desc> {
return mergeFromJson(
): void {
mergeFromJson(
messageDesc,
target,
parseJsonString(json, messageDesc.typeName),
Expand Down Expand Up @@ -156,7 +156,7 @@ export function mergeFromJson<Desc extends DescMessage>(
target: MessageShape<Desc>,
json: JsonValue,
options?: Partial<JsonReadOptions>,
): MessageShape<Desc> {
): void {
try {
readMessage(reflect(messageDesc, target), json, makeReadOptions(options));
} catch (e) {
Expand All @@ -168,7 +168,6 @@ export function mergeFromJson<Desc extends DescMessage>(
}
throw e;
}
return target;
}

function readMessage(
Expand Down

0 comments on commit 01045de

Please sign in to comment.