Files
scriptc/tests
Chris Tate 5c015be6be Try wider record arms first when a dyn value converts to a union
Records are width-tolerant, and a union's arms were tried in canonical
order, which sorts record arms by shape id. When a `{}` arm, or an arm
whose fields are all optional, came first, it took every object, so a
value converted to the union lost the fields only a wider arm has:

    const pairs = [["a", { publicKeyEncoding: 5 }], ["b", {}]];
    for (const [, v] of pairs) console.log(Object.keys(v));

printed [] twice, where Node prints [ 'publicKeyEncoding' ] and [].
A checked cast to `{ p: number; q: string } | { p?: number }` dropped
`q` the same way.

The checked conversion now tries record arms with more required fields
first, then those with more fields, and keeps the canonical order
otherwise. The union's tags are unchanged.
2026-10-23 07:47:26 -05:00
..
…
2026-10-20 17:56:44 -05:00