farrow icon indicating copy to clipboard operation
farrow copied to clipboard

`Type alias circularly references` and `Index signature is missing` conflict

Open tqma113 opened this issue 3 years ago • 1 comments

image

https://codesandbox.io/s/jovial-cannon-0zffb?file=/src/index.ts

https://www.typescriptlang.org/play?#code/C4TwDgpgBAUgzgewHYBVzQLwCgpQD5RICuAtgEYQBOO+UcwlAlkgOY0FkIIA2EAhknaEi3bkKJIAJhABmzCJKHxkaSAG0AukIDeNXLmAIYAZQDyAOQAUASgBcdBszb6oAXyEAlCAGMElSQA89EysADSwiKjoAHxYWKCQESroAIJQGFBCxORUQsFOQpw8-IK4BMSi4lKy8oplSVGQKZo6evqGJhY29vmsbe71ui5qANYQID2OrBr2yo0QKTTuWN7cfHBwUABiXFDay7zAUDK7GftQ69tccTIS3sCMyFBkfJSWzGBEwLORqgvWe2WLzeJwQ1iAA

https://www.typescriptlang.org/play?#code/C4TwDgpgBAYg9nKBeKBvAvgKAJYDtgQBOAZgIYDG0AQqYWlpqJFAILKwJQQAeBuAJgGcoNOgH4owQgFdoALihkANoOgB6NZJkRG4au1FdeEAcPiIJU2VAXLVUDVtmZdzAMLtzRvkKgAlCHI4Qn4AHkEpPABzABooaVwAa1w4AHdcAD4oS20bRVIVdU0rHSZoABEDWm8TXwCgkPDI3Fj4pJT0rJzrWwL7RzsdV2gAUXZ64LCIwmi4hOS0zJrTDgsneXzCh2LtYdhxwMmmmZa59sWsnh9hQ26Nwe31l0dUgAsQEWqr2uEJxunZm0Fp0oNhhIMxEA

can't create perfect circular object type

https://github.com/microsoft/TypeScript/issues/14174

tqma113 avatar May 18 '21 12:05 tqma113

Yes, the expected value of the JsonType is generally the plain javascript object/value, not the class instance

If it is a class instance, it is expected to have a toJSON method that will be called during JSON.stringify to get the plain value, such as Date

Lucifier129 avatar May 18 '21 13:05 Lucifier129