Is it normal for error messages / potentially behaviour to change depending on jitless?

I wanted to do some stuff with discriminated unions with jitless: true (due to a bug with jitless that has been fixed) and i noticed that the validation behaviour was different when i set it to jitless: false . Sadlly i didn't manage to reproduce the different validation behaviour but if you paste this into the web playground
const formScope = scope({
"form.number": "string.numeric.parse",
"form.integer": "string.integer.parse",
"form.string": "string > 0"
})

configure({
jitless: true
})

const ark = formScope

const vehicle = ark.type({
type: '"car" | "motorcycle" | "caravan"',
brand: "form.string",
model: "form.string",
buildYear: "form.string",
performance: "form.integer",
performanceUnit: '"kW" | "PS"'
})

const Thing = ark.type.or(
{
purpose: ark.unit("vehicle"),
vehicle: vehicle
},
{
purpose: ark.unit("modernization"),
modernization: "'energetic_modernization' | 'other'"
},
{
purpose: ark.unit("free_use"),
}
)

const out = Thing({
purpose: "modernization",
vehicle: {
type: undefined,
brand: undefined,
model: undefined,
buildYear: undefined,
performance: undefined,
performanceUnit: undefined
}
})
const formScope = scope({
"form.number": "string.numeric.parse",
"form.integer": "string.integer.parse",
"form.string": "string > 0"
})

configure({
jitless: true
})

const ark = formScope

const vehicle = ark.type({
type: '"car" | "motorcycle" | "caravan"',
brand: "form.string",
model: "form.string",
buildYear: "form.string",
performance: "form.integer",
performanceUnit: '"kW" | "PS"'
})

const Thing = ark.type.or(
{
purpose: ark.unit("vehicle"),
vehicle: vehicle
},
{
purpose: ark.unit("modernization"),
modernization: "'energetic_modernization' | 'other'"
},
{
purpose: ark.unit("free_use"),
}
)

const out = Thing({
purpose: "modernization",
vehicle: {
type: undefined,
brand: undefined,
model: undefined,
buildYear: undefined,
performance: undefined,
performanceUnit: undefined
}
})
you will see that the error message differs depending on the jitless setting. Is this intended?
1 Reply
ssalbdivad
ssalbdivad2w ago
Ideally they'd always be identical but it is known that there are a couple differences and this is the biggest. We have an open issue to address it- https://github.com/arktypeio/arktype/issues/961

Did you find this page helpful?