mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-27 06:43:19 +08:00
A checked conversion to a union of object types tests each member's fields with the members' matchers. For a field of type `C | undefined` holding a class instance, the union's matcher found the instance's capsule, which is not a capsule of the union itself, and answered no (or matched the instance's plain-object view, which no class arm accepts), so no member matched and the conversion threw a TypeError. workerData read as such a union failed this way in every worker. A union now matches capsules of other types through its arms, where the class arm accepts the instance.