Don't defer index types for non-generic substitution types#61999
Don't defer index types for non-generic substitution types#61999Andarist wants to merge 1 commit intomicrosoft:mainfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR ensures that index types on non-generic substitution types are resolved immediately (instead of deferred), addressing #61728.
- Added two new compiler tests to verify index lookups on non-generic substitution types.
- Modified
getIndexTypeinchecker.tsto bypass deferral when bothbaseTypeandconstraintare non-generic.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/cases/compiler/substitutionTypeNonGenericIndexType1.ts | Adds a test for boolean conditional index resolution on non-generic substitution types. |
| tests/cases/compiler/substitutionTypeNonGenericIndexType2.ts | Adds a test for infer-based index resolution on non-generic substitution types. |
| src/compiler/checker.ts | Updates getIndexType to immediately compute index types for non-generic substitutions. |
Comments suppressed due to low confidence (3)
tests/cases/compiler/substitutionTypeNonGenericIndexType2.ts:1
- [nitpick] Consider adding a reference to GitHub issue #61728 at the top of this test for consistency with related test files.
// @strict: true
tests/cases/compiler/substitutionTypeNonGenericIndexType2.ts:14
- [nitpick] Consider adding additional test cases where either the
baseTypeor theconstraintis generic to ensure this new index type logic covers mixed generic scenarios.
const test: Test["rejectClose"] = "rejectClose";
|
@typescript-bot test it |
|
Hey @jakebailey, I've packed this into an installable tgz. You can install it for testing by referencing it in your and then running There is also a playground for this build and an npm module you can use via |
|
Hey @jakebailey, the results of running the DT tests are ready. Everything looks the same! |
|
@jakebailey Here are the results of running the user tests with tsc comparing There were infrastructure failures potentially unrelated to your change:
Otherwise... Everything looks good! |
|
@jakebailey Here they are:
tscComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@jakebailey Here are the results of running the top 400 repos with tsc comparing Everything looks good! |
fixes #61728