Repository navigation
Simplify string index signatures outside member resolution - #65632
Open
zzy (zzy2008) wants to merge 2 commits into
Open
zzy (zzy2008) wants to merge 2 commits into
zzy (zzy2008) wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟢 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
Author
|
@microsoft-github-policy-service agree |
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. |
zzy (zzy2008)
force-pushed
the
codex/ts-65127-string-index-signatures
branch
from
November 22, 2026 12:24
cdef002 to
9c4f2d4
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 asDict[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
go -C ./tsc test ./internal/testrunnernpx hereby validate --allpassed 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 withnpx hereby test.npx hereby tidyandnpx hereby check:formatgit diff --exit-code