Skip to content

Use lower bound of index types as their constraints when they are applied to indexed access types with non-generic root object type #60091

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

Closed

Conversation

Andarist
Copy link
Contributor

closes #21760

Even though keyof SomeMap[T] is deferred and generic, the actual possible keys are known as long as SomeMap is not generic itself. Such SomeMap has a "closed shape" so it feels it's safe to get a lower bound of that type as its constraint.

…lied to indexed access types with non-generic root object type
@typescript-bot typescript-bot added the For Backlog Bug PRs that fix a backlog bug label Sep 28, 2024
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Those date to #52399 and #53059 (that was later reverted by #54845 ). The original intention was for those not to be errors. This is issue was essentially a duplicate of the one I'm fixing here ( #21760 ). So it makes sense that those errors are gone - as long as my proposed fix is correct.

@Andarist Andarist marked this pull request as draft September 28, 2024 14:53
@Andarist Andarist closed this Sep 28, 2024
@sandersn sandersn removed this from PR Backlog Apr 22, 2025
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
None yet
Development

Successfully merging this pull request may close these issues.

Error: Type cannot be used to index type after two indexes
2 participants