Skip to content

Commit

Permalink
Update debugJsonValue to accept unknown (#535)
Browse files Browse the repository at this point in the history
  • Loading branch information
GauBen authored Aug 1, 2023
1 parent a6af1c1 commit 7add029
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/protobuf-bench/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ server would usually do.

| code generator | bundle size | minified | compressed |
|---------------------|------------------------:|-----------------------:|-------------------:|
| protobuf-es | 88,672 b | 37,773 b | 9,865 b |
| protobuf-es | 88,669 b | 37,770 b | 9,843 b |
| protobuf-javascript | 394,384 b | 288,761 b | 45,123 b |
4 changes: 2 additions & 2 deletions packages/protobuf/src/private/json-format-common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ export function makeJsonFormatCommon(
};
}

function debugJsonValue(json: JsonValue): string {
function debugJsonValue(json: unknown): string {
if (json === null) {
return "null";
}
Expand All @@ -338,7 +338,7 @@ function debugJsonValue(json: JsonValue): string {
case "string":
return json.length > 100 ? "string" : `"${json.split('"').join('\\"')}"`;
default:
return json.toString();
return String(json);
}
}

Expand Down

0 comments on commit 7add029

Please sign in to comment.