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
Originally posted by agladysh November 12, 2024
A somewhat silly reduced example:
import{ArkErrors,scope}from'arktype';const$=scope({literal: '"foo"',record: {'[string]': 'value'},value: 'literal|literal[]|record',}).export();constresult=$.value({});if(resultinstanceofArkErrors){// Error: must be an array (was object)thrownewError(result.summary);}console.log('passed');
All three types in value seem to be necessary to reproduce the issue.
Activity
[-]Arrays of literals and recursive objects don't seem to mix well[/-][+]Some cyclic unions incorrectly reduced[/+]ssalbdivad commentedon Nov 22, 2024
This is definitely a bug, likely to do with the way the recursive references and reduced in the union.
fix(schema): dispatch interpreted unions on their discriminant
test(type): restore 2.2.7's cyclic realWorld tests