arktype icon indicating copy to clipboard operation
arktype copied to clipboard

Fix circular inference on cyclic thunk reference

Open ssalbdivad opened this issue 1 year ago • 0 comments

We previously had a test case like this:

const $ = scope({
  a: () => $.type({ b: "b" }),
  b: () => $.type({ a: "a" }),
});

Sometime during implementing subscopes/generics, the inference broke (now gives a circular reference error). This may be a case where it's ideal to work with the compiler directly to diagnose what might be going wrong here while preserving some of the other improvements we've made, although it is a deeply cyclic case so I honestly was impressed TS could resolve it in the first place.

ssalbdivad avatar Jun 28 '23 21:06 ssalbdivad