mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-04 08:04:37 +08:00
`filter[resourceType]` where the receiver is a record with several optional members and the key type is a finite union of literal keys (`"extensions" | "skills" | ...`) refused with SC1090 whenever the checker's answer type did not cover every declared field. That is the common settings-record shape: the key domain names four of the members and the rest have unrelated types. The key type is a finite domain, so the read now dispatches over exactly the fields it can name, comparing the key against each canonical property spelling. The answer is the join of the reachable fields' types — precisely the checker's answer type — and a key outside the domain reads undefined, as a missing property does. Nothing is emitted for a field the key type cannot name, so no widening to the full record leaks into downstream lowering. The dispatch is gated on the shape having no index signature, on the access not being a call (`o[k]()` keeps its fence for inherited methods), on the reachable fields being a proper subset, and on the join holding an undefined arm so a smuggled key has an answer. A key domain that names every field keeps the single keyed-read helper. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>