Skip to content

Flexbuffers arithmetic missing BigInt/Number conversion [JS/TS, npm@23.5.26] #8009

@jcmoore

Description

@jcmoore

Invoking

toObject(
  new Uint8Array([116,0,118,0,98,108,117,114,0,102,111,99,117,115,0,116,77,111,110,111,0,116,78,111,119,0,116,90,111,110,101,0,117,114,108,0,0,0,6,35,31,26,21,17,12,0,0,0,9,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,222,33,222,34,162,142,120,66,216,193,35,234,136,1,0,0,44,1,0,0,0,0,0,0,75,0,0,0,0,0,0,0,4,4,15,7,5,20,2,127,126,2,1,2,3,61,4,39,4,36,1]).buffer
);

causes Uncaught TypeError: Cannot mix BigInt and other types, use explicit conversions around here.

Looks like type coercions are already happening elsewhere, so I'd guess another coercion would not hurt, but I haven't grokked the how and why of indirect numbers sufficiently to know for sure.


Edit 1: somewhat related, toObject(new Uint8Array([2,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,0,64,129,162,176,142,120,66,4,15,18,43,1])) reveals a few other as number type assertions that should probably be substituted for Number(value) coercions.

Example buffers are coming from my investigation of #8010

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions