arktype
arktype copied to clipboard
Fix circular inference on cyclic thunk reference
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.