mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-04 08:04:37 +08:00
`(x as T)["m"]` — the element-access spelling of a member probe — was not recognized as a probe, so it went through the assertion's checked extraction and trapped exactly like the property spelling did before #2443. Recognize a literal-key element access as the same probe, and answer it per arm there too. `"m" in (x as T)` is likewise a probe of the asserted value, not a use of the assertion: accept a union whose arms are all records or units when the per-arm `in` answers every arm, so the optional-arm shape compiles instead of refusing with SC1090. A real use of the asserted member keeps the checked extraction and still throws on a lying assertion. tests/corpus/8512-asserted-probe-element-and-optional.ts pins the bracket spelling, the member probe, and the throwing real use against Node. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>