Skip to content

Read T[keyof T] as unknown for T bound to an unknown-valued record - #1485

Merged
ctate merged 1 commit into
opt/trace-reachable-blockersfrom
opt/bc-generic-unknown-entries
Oct 20, 2026
Merged

ctate merged 1 commit into
opt/trace-reachable-blockersfrom
opt/bc-generic-unknown-entries

Conversation

@cramforce

Copy link
Copy Markdown
Contributor

Stacked on #1433 (opt/trace-reachable-blockers).

Inside a generic body, Object.entries(t) over T extends Record<string, unknown> types its elements as [string, keyof T extends never ? unknown : T[keyof T]]. #1433 resolves that conditional, and T[keyof T], against a bound record. An instance whose T is Record<string, unknown>, which maps to the checked-dynamic value, still failed with SC2009. Now T[keyof T] over such a T reads as unknown. The conditional also reads as unknown, because both of its branches agree.

Evidence

  • 6468-generic-unknown-record-entries.ts is byte-identical to Node in both lanes and fails on the base branch.
  • Zero-cost gate against opt/trace-reachable-blockers c17eec0: PASS, 2478 of 2478 identical (bench, self-hosted compiler, corpus).
  • pnpm lint and pnpm format:check are clean. pnpm test:ts7 --baselines-only passes.

🤖 Generated with Claude Code

Inside a generic body Object.entries(t) over T extends Record<string,
unknown> types its values 'keyof T extends never ? unknown : T[keyof T]'.
An instance whose T maps to the checked-dynamic value now reads both
branches as unknown.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
scriptc Ready Ready Preview, v0 Oct 20, 2026 5:13am UTC

@ctate
ctate merged commit 6d898dc into opt/trace-reachable-blockers Oct 20, 2026
23 checks passed
@ctate
ctate deleted the opt/bc-generic-unknown-entries branch October 20, 2026 05:17

This branch was successfully deployed

1 active deployment
Preview — c208973d Deployed Oct 20, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants