You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
circular scope, scope compilation bug, Apply is not a function.
🧩 Context
ArkType version: 2.0.0-rc.21
TypeScript version (5.1+): Version 5.7.0-dev.20241002
Other context you think may be relevant (JS flavor, OS, etc.): N/A
🧑💻 Repro
Minimum repro:
import{scope,type}from"arktype"const$=scope({Foo: {"oneOf?": "Bar[]"// NB: don't get the error if this is not an array},Bar: "Foo"}).export()constbaz=$.Bar.pipe((_: object): type.Any|undefined=>{console.log("this never gets logged since pipe isn't entered")returntype("string")})constr=baz({oneOf: [{}]})// throws "TypeError: this.Foo1Apply is not a function"console.log(r)
Hi David, I'm using jitless 'true', but having weird issues like the author of that repro. It looks I need to hold off my migration from zod to Arktype using until this bug is fixed. I'm following an implementation like that with cyclic types rendering cms components. I need to comment the cyclic types to make it work, otherwise it throws error(The ... is not a function). Otherwise I got this error .
Activity
Kal-Aster commentedon Dec 18, 2024
I encountered this right now 💀
Meanwhile is there any workaround?
ssalbdivad commentedon Jan 26, 2025
As a temporary workaround, you can try passing
{ jitless: true }to your scope since this issue seems specific to precompilation:ssalbdivad commentedon Mar 12, 2025
Adding the repro from #1367 which I've closed as a likely duplicate (should be added as a test case when this is addressed):
Christopher96u commentedon Apr 10, 2025
Hi David, I'm using jitless 'true', but having weird issues like the author of that repro. It looks I need to hold off my migration from zod to Arktype using until this bug is fixed. I'm following an implementation like that with cyclic types rendering cms components. I need to comment the cyclic types to make it work, otherwise it throws error(The ... is not a function). Otherwise I got this error .
fix(schema): dispatch interpreted unions on their discriminant
test(type): restore 2.2.7's cyclic realWorld tests