dfahlander / typeson-registry

The type registry for typeson

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A bug with bigint and map

Jack-Works opened this issue · comments

var t = require('typeson')
var y = new t().register(require('typeson-registry/dist/presets/builtin'))
var p = y.stringify({map: new Map([[1, 1n], [0, 1n]])})
y.parse(p)
// { map: Map(2) { 1 => 1n, 0 => undefined } }

Expected:
{ map: Map(2) { 1 => 1n, 0 => 1n } }

Actual:
{ map: Map(2) { 1 => 1n, 0 => undefined } }

Was a bug in typeson (primitive values left as part of encapsulation (such as with bigint) that were encountered more than once were treated as cyclic). Plan to update typeson-registry as well shortly.

Fixed and released in v1.0.0-alpha.34. Thanks for the report!