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
{{ message }}
Repository navigation
Union discriminated on an "undefined" value throws TypeError for non-object input #1724
import{type}from"arktype"constThing=type({k: "1",a: "2"}).or({k: "3",a: "undefined"})Thing.allows(0)// TypeError: Cannot use 'in' operator to search for 'k' in 0Thing(0)// TypeError: Cannot use 'in' operator to search for 'k' in 0
Expected false and an ArkErrors instance, as with a: "null" in the second branch. The same happens for "s", null and undefined as input.
The union is discriminated on a with an undefined case. pruneDiscriminant then removes the domain: "object" check from that branch, but data?.a === undefined is also true for primitives (and for objects without a: type({ a: "2" }).or({ a: "undefined" }).allows({}) returns true).
Activity
docs(changelog): describe the November bug fixes and thank their PR a…
ssalbdivad commentedon Nov 18, 2026
Fixed in 3.0.0-beta.0 (#1728). Try it with
npm i arktype@next.test: cover undefined discriminant cases on a nested path