dfahlander / typeson-registry

The type registry for typeson
MIT License
6 stars 5 forks source link

A bug with bigint and map #15

Closed Jack-Works closed 4 years ago

Jack-Works commented 4 years ago
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 } }

brettz9 commented 4 years ago

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.

brettz9 commented 4 years ago

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