deepkit-framework
deepkit-framework copied to clipboard
[type] assert cannot convert circular structure to json
Test can be found here https://github.com/marcus-sa/ngkit/blob/be76fee58879546d42d3a33ab8afe3a4055a1a7a/packages/core/src/lib/router/process.spec.ts#L78-L84
Error: Uncaught (in promise): TypeError: Converting circular structure to JSON
--> starting at object with constructor 'RouterStateSnapshot'
| property '_root' -> object with constructor 'TreeNode'
| property 'value' -> object with constructor 'ActivatedRouteSnapshot'
--- property '_routerState' closes the circle
TypeError: Converting circular structure to JSON
--> starting at object with constructor 'RouterStateSnapshot'
| property '_root' -> object with constructor 'TreeNode'
| property 'value' -> object with constructor 'ActivatedRouteSnapshot'
--- property '_routerState' closes the circle
at JSON.stringify (<anonymous>)
at ValidationErrorItem.toString (/Users/marcus-sa/Git/deepkit/deepkit-framework/packages/type/src/validator.ts:97:40)
at /Users/marcus-sa/Git/deepkit/deepkit-framework/packages/type/src/validator.ts:112:104
at Array.map (<anonymous>)
at new ValidationError (/Users/marcus-sa/Git/deepkit/deepkit-framework/packages/type/src/validator.ts:112:93)
at Module.assert (/Users/marcus-sa/Git/deepkit/deepkit-framework/packages/type/src/typeguard.ts:47:15)
NB: I just realized that the assertion is bound to fail because it expects an array when the actual value is an object, but that doesn't change the fact that the error above shouldn't occur ^