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
boolean unioned with a recursive discriminated union, recursion, recursive discriminated union
🧩 Context
ArkType version: 2.0-dev.26
TypeScript version (5.1+): 5.5
Other context you think may be relevant (JS flavor, OS, etc.): N/A
🧑💻 Repro
import{scope}from"arktype"const$=scope({TypeWithNoKeywords: {type: "'boolean'|'null'"},TypeWithKeywords: "ArraySchema|ObjectSchema",// without both ArraySchema and ObjectSchema there's no error// "#BaseSchema": "TypeWithNoKeywords|boolean", // errors even with union reversed"#BaseSchema": "boolean|TypeWithNoKeywords",// without the `boolean` there's no error (even if still union such as `string|TypeWithNoKeywords`)ArraySchema: {"additionalItems?": "BaseSchema",// without this recursion there's no errortype: "'array'"},// If `ObjectSchema` doesn't have `type` key there's no errorObjectSchema: {type: "'object'"}})exportconstJsonSchema=$.export()// TypeError: Cannot use 'in' operator to search for 'type' in false
The validateObjectLiteral type doesn't account for the => operator and when it discovers an unaccounted for operator it assumes it's the = (default) operator. I'm guessing this is the cause.
The text was updated successfully, but these errors were encountered:
Report a bug
🔎 Search Terms
boolean unioned with a recursive discriminated union, recursion, recursive discriminated union
🧩 Context
🧑💻 Repro
The
validateObjectLiteral
type doesn't account for the=>
operator and when it discovers an unaccounted for operator it assumes it's the=
(default) operator. I'm guessing this is the cause.The text was updated successfully, but these errors were encountered: