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
Just discovered that metadata also isn't preserved for discriminated union, meaning e.g. .describe() descriptions are lost
import{type}from"arktype";constt=type("string<2").describe("foo")constt2=t.or(type("string>=2").describe("bar"))// non-discriminated unionconsole.log(t2.assert({}));// references 'foo' and 'bar' in the errorconstt3=t.or(type("number").describe("baz"));// discriminated unionconsole.log(t3.assert({}));// references 'string' and 'number', instead of 'foo' and 'baz'
Activity
TizzySaurus commentedon Mar 6, 2025
Of note:
Just discovered that metadata also isn't preserved for discriminated union, meaning e.g.
.describe()descriptions are lostfix(schema): use a union's description when data misses its cases
fix(schema): describe a discriminated union's miss by the description…
Merge branch 'lane/integrate' into lane/breaking-prep
fix(type): report a precompiled union's miss where arktype does
feat(schema): write a described union's errors from its description
ssalbdivad commentedon Nov 18, 2026
Fixed in 3.0.0-beta.0 (#1728). Try it with
npm i arktype@next.