Skip to content

Commit 1735ed2

Browse files
committed
encoder: Encode instances of Number as numbers, not maps
1 parent 4a337c5 commit 1735ed2

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/Encoder.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,8 @@ export class Encoder<ContextType = undefined> {
339339
const ext = this.extensionCodec.tryToEncode(object, this.context);
340340
if (ext != null) {
341341
this.encodeExtension(ext);
342+
} else if (object instanceof Number) {
343+
this.encodeNumber(object.valueOf());
342344
} else if (Array.isArray(object)) {
343345
this.encodeArray(object, depth);
344346
} else if (ArrayBuffer.isView(object)) {

0 commit comments

Comments
 (0)