diff --git a/src/util/proxies.ts b/src/util/proxies.ts index 6e7a6f1..f712470 100644 --- a/src/util/proxies.ts +++ b/src/util/proxies.ts @@ -36,8 +36,13 @@ export function createLazyProxy( ): T { const obj: S & Partial = baseObject; let calculated = false; + let calculating = false; function calculateObj(): T { if (!calculated) { + if (calculating) { + throw new Error("Cyclical dependency detected. Cannot evaluate lazy proxy."); + } + calculating = true; Object.assign(obj, objectFunc.call(obj, obj)); calculated = true; }