Skip to content

Commit 3e36742

Browse files
committed
Clean up
1 parent 2f58b4f commit 3e36742

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/firestore/src/remote/serializer.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ export function toBytes(
252252
*/
253253
export function fromBytes(
254254
serializer: JsonProtoSerializer,
255-
value: string | Uint8Array | Buffer | undefined
255+
value: string | Uint8Array | undefined
256256
): ByteString {
257257
if (serializer.useProto3Json) {
258258
hardAssert(
@@ -263,6 +263,10 @@ export function fromBytes(
263263
} else {
264264
hardAssert(
265265
value === undefined ||
266+
// The Buffer interface extends the Uint8Array interface, however
267+
// the Uint8ArrayConstructor is not in the prototype chain of
268+
// Buffer, so we have to test `value instanceof Buffer` and
269+
// `value instanceof Uint8Array`.
266270
value instanceof Buffer ||
267271
value instanceof Uint8Array,
268272
'value must be undefined, Buffer, or Uint8Array'

0 commit comments

Comments
 (0)