Skip to content

Commit 3fed6f3

Browse files
committed
Add missing export annotation for BinaryReader.readStringRequireUtf8
BinaryReader.readStringRequireUtf8 may be called by users (particularly the protobuf conformance suite) and therefore needs to visible after minification/google closure prop renaming. This change also fixes a type warning around something we assert is present.
1 parent f418f58 commit 3fed6f3

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

binary/decoder.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,8 @@ jspb.BinaryDecoder.prototype.readString = function (length, requireUtf8) {
902902
this.cursor_ += length;
903903
this.checkCursor();
904904
const result =
905-
jspb.binary.utf8.decodeUtf8(jspb.asserts.assert(this.bytes_), cursor, length, requireUtf8);
905+
jspb.binary.utf8.decodeUtf8(/** @type {!Uint8Array} */(jspb.asserts.assert(this.bytes_)),
906+
cursor, length, requireUtf8);
906907
return result;
907908
};
908909

binary/reader.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,6 +1034,7 @@ jspb.BinaryReader.prototype.readString = function() {
10341034
* not valid utf8.
10351035
*
10361036
* @return {string} The value of the string field.
1037+
* @export
10371038
*/
10381039
jspb.BinaryReader.prototype.readStringRequireUtf8 = function () {
10391040
jspb.asserts.assert(this.nextWireType_ == jspb.BinaryConstants.WireType.DELIMITED);

0 commit comments

Comments
 (0)