Open tmeasday opened 1 year ago
These lines: https://github.com/storybookjs/telejson/blob/6d2e7a4b7704c927a7dc7b5cb1735cc252922302/src/index.ts#L149-L150 assume objects cannot have keys ''. As we saw in https://github.com/storybookjs/storybook/pull/20755, that isn't a good assumption.
''
## in node REPL > const b = {} undefined > b[''] = { b: b} <ref *1> { b: { '': [Circular *1] } } > require('telejson').stringify(b) Uncaught TypeError: Converting circular structure to JSON --> starting at object with constructor 'Object' | <anonymous> -> object with constructor 'Object' --- property 'b' closes the circle at JSON.stringify (<anonymous>) at Object.stringify (/Users/tom/GitHub/chromaui/chromatic/node_modules/telejson/dist/cjs/index.js:467:15)
It should stringify correctly.
Describe the bug
These lines: https://github.com/storybookjs/telejson/blob/6d2e7a4b7704c927a7dc7b5cb1735cc252922302/src/index.ts#L149-L150 assume objects cannot have keys
''
. As we saw in https://github.com/storybookjs/storybook/pull/20755, that isn't a good assumption.Steps to reproduce the behavior
Expected behavior
It should stringify correctly.