Skip to content

Simplify string index signatures outside member resolution - #65632

Open
zzy (zzy2008) wants to merge 2 commits into
microsoft:mainfrom
zzy2008:codex/ts-65127-string-index-signatures
Open

zzy (zzy2008) wants to merge 2 commits into
microsoft:mainfrom
zzy2008:codex/ts-65127-string-index-signatures

Conversation

@zzy2008

Copy link
Copy Markdown

Fixes #65127.

The circularity guard added in #65059 excluded every class, interface, and generic reference from the string-index-only check. This leaves Dict[K] deferred even when the only member is a string index signature, so a conditional such as Dict[K] extends number ? ... : ... can produce TS2345.

Track which object types are currently resolving members and skip the simplification for those types. The regression covers an interface, a class, and a generic interface instance under both default and types-first checking.

Validation

  • The new case produced TS2345 for all three inputs before the fix and no diagnostics after it.
  • go -C ./tsc test ./internal/testrunner
  • npx hereby validate --all passed the extension, API, tools, codegen, smoke, lint, and format checks. The Go suite ran out of disk space in that run, then passed on retry with npx hereby test.
  • npx hereby tidy and npx hereby check:format
  • git diff --exit-code

Copilot AI balanced review requested due to automatic review settings November 22, 2026 09:26
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Nov 22, 2026
@typescript-automation typescript-automation Bot added the For Backlog Bug PRs that fix a backlog bug label Nov 22, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

There are no active review issues for the change restoring string-index-only simplification while retaining the circularity guard.

No open issues 🎉

What changed in this PR

Addresses #65127, a regression from #65059, by restoring string-index-only simplification for interfaces, classes, and generic instances while retaining the circularity guard during active member resolution.

Changes:

  • Track object types whose members are currently resolving instead of permanently excluding classes, interfaces, and references.
  • Add regression coverage and type/symbol baselines for default and types-first checking.
File Description
tsc/​testdata/​tests/​cases/​compiler/​stringIndexSignatureIndexedAccess.ts Tests indexed-access simplification for three dictionary forms.
tsc/​testdata/​baselines/​reference/​compiler/​stringIndexSignatureIndexedAccess(checkorder=typesfirst).types Records simplified types under types-first checking.
tsc/​testdata/​baselines/​reference/​compiler/​stringIndexSignatureIndexedAccess(checkorder=typesfirst).symbols Records symbol bindings under types-first checking.
tsc/​testdata/​baselines/​reference/​compiler/​stringIndexSignatureIndexedAccess(checkorder=default).types Records simplified types under default checking.
tsc/​testdata/​baselines/​reference/​compiler/​stringIndexSignatureIndexedAccess(checkorder=default).symbols Records symbol bindings under default checking.
tsc/​internal/​checker/​checker.go Limits the simplification guard to active member resolution.

Review effort: Balanced

@zzy2008

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@jakebailey

Copy link
Copy Markdown
Member

If you're willing, this would be much easier to review if it were two commits, one that adds the test and baselines showing bad behavior, then one commit with the fix and baseline update showing it works.

@zzy2008
zzy (zzy2008) force-pushed the codex/ts-65127-string-index-signatures branch from cdef002 to 9c4f2d4 Compare November 22, 2026 12:24

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Backlog Bug PRs that fix a backlog bug

Projects

Status: Not started

Development

Successfully merging this pull request may close these issues.

Native tsc: interface-only string index signatures no longer simplify under generic indexed access (regressed in #65059)

3 participants