Files
scriptc/packages
Malte UblandClaude Opus 5.5 b5e99ac67b Name the deepest failing path when a checked cast fails inside an optional record
A checked cast such as `JSON.parse(text) as Partial<T>` makes every member
an `X | undefined` union. When a present object failed X, the error named
only the union's own path ("expected object | undefined at $.order, got
object"), not the missing or mistyped member inside it.

When no arm of a union matches and the value is the one container kind
exactly one arm can take (an object for the union's only record arm, an
array for its only array arm, beside unit and scalar arms), the failure
block now runs that arm's builder, which throws at the deepest failing
path with its reason ("expected string at $.order.owner.id, got
number"). Other values keep the union's message.

Only the failure block of union dynCheck builders changes; the matching
path is untouched.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 13:13:35 -07:00
..
2026-10-18 19:55:52 -05:00
2026-10-18 09:55:59 -05:00
2026-10-20 11:36:33 -05:00