Piping types no longer works
In previous version of ArkType (have tested
2.0.0-rc.7
and below), this worked as intended where it'll throw an error since d
does not match a/b/c.
In ArkType >= 2.0.0-rc.13
this now doesn't throw an error and instead outputs d
6 Replies
Produces:
ctx.error(result.summary)
works, but then duplicates the error AggregateError: must be must be "a", "b" or "c" (was "d") (was "d")
This seems to produce the same behavior I'm accustomed to:
hmm, not quite
Got it This will work better if you just .to or .pipe to Letters directly rather than creating your own wrapper function that passes s. Still, this should continue to work and I will fix it in the next release.
But if you pipe to a type directly, you get introspectable output and optimizations in addition to it being more concise
Ok that works. I think it was broken in the past which is why I had to wrap it, but seems to be working now
The original case is fixed in 2.0.0-rc.14, though best continue to use
.to
directlyWhat's the difference between
pipe
and to
?
I'll add to JSDoc prTo accepts a single type definition so is mainly a convenience so that if you're defining an output, you don't have to rewrap in type. It's also only available if your type is already a morph.