Unions with optional params?

Are unions with optional params supported in arktype?

Example:
import { type, union } from "arktype"

const a = type({
    direction: "'forward' | 'backward'",
    "operator?": "'by'"
})

const b = type({
    duration: "'s' | 'min' | 'h'",
    "operator?": "'to'"
})

const c = union(a, b)

type TypeC = typeof c.infer

const test: TypeC = {
    direction: "forward"
}

console.log("a", a(test))
console.log("c", c(test))

c.assert(test) // operator must be 'by' or 'to' (was undefined)

https://stackblitz.com/edit/fhz11y?file=type.ts
StackBlitzJack Steam
ArkType type demo
Was this page helpful?