Skip to content

Don't defer index types for non-generic substitution types #61999

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Andarist
Copy link
Contributor

@Andarist Andarist commented Jul 6, 2025

fixes #61728

@Copilot Copilot AI review requested due to automatic review settings July 6, 2025 12:12
@github-project-automation github-project-automation bot moved this to Not started in PR Backlog Jul 6, 2025
@typescript-bot typescript-bot added For Backlog Bug PRs that fix a backlog bug labels Jul 6, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

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 getIndexType in checker.ts to bypass deferral when both baseType and constraint are 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 baseType or the constraint is generic to ensure this new index type logic covers mixed generic scenarios.
const test: Test["rejectClose"] = "rejectClose";

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.

Poor quick info due to erroneously deferring keyof T since #51621
2 participants