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
D:\***\node_modules\@ark\util\out\errors.js:5 throw new ctor(message); ^ParseError: T must be assignable to object (was $AEditing&intersection250 | { editableA: number, nodes: ($NodeB | { editableA: number, type: "a" })[], type: "b", edits?: undefined }) at throwError (D:\***\node_modules\@ark\util\out\errors.js:5:11) at throwParseError (D:\***\node_modules\@ark\util\out\errors.js:10:43) at <anonymous> (D:\***\node_modules\@ark\schema\out\generic.js:21:21) at <anonymous> (D:\***\node_modules\@ark\util\out\flatMorph.js:4:39) at Array.flatMap (<anonymous>) at flatMorph (D:\***\node_modules\@ark\util\out\flatMorph.js:3:39) at GenericRoot.<anonymous> (D:\***\node_modules\@ark\schema\out\generic.js:18:30) at parseGenericInstantiation (D:\***\node_modules\arktype\out\parser\shift\operand\unenclosed.js:18:12) at maybeParseReference (D:\***\node_modules\arktype\out\parser\shift\operand\unenclosed.js:40:16) at unenclosedToNode (D:\***\node_modules\arktype\out\parser\shift\operand\unenclosed.js:20:40)Node.js v22.12.0
I need the validation for a type that can have this "edits" property and based on the presence of this property and its actual structure (it could be another type of edits, in the actual usage) I need to narrow the type of "nodes".
This issue is similar to #1188. Unfortunately, there are still a few issues related to complex cyclic unions.
Handling these precisely will require a more significant refactor as outlined in #1026.
In the meantime, the best workaround would be to just avoid the problematic cyclic reference directly in the type and instead recurse by invoking the type directly from a .narrow.
Report a bug
🔎 Search Terms
"discriminated"
"intersect"
"ParseError: T must be assignable to object"
🧩 Context
🧑💻 Repro
I get the following error:
I need the validation for a type that can have this "edits" property and based on the presence of this property and its actual structure (it could be another type of edits, in the actual usage) I need to narrow the type of "nodes".
In TS it works:
I'm new to this library: is this actually a bug or am I doing something wrong?
The text was updated successfully, but these errors were encountered: