Skip to content

Fix #28798: Treat primitive key types as empty when relating to indexer from generic mapped type. #29699

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

Conversation

jack-williams
Copy link
Collaborator

@jack-williams jack-williams commented Feb 2, 2019

Fixes #28798

When relating source type T to a target type { [P in U]: X }, the GLB of keyof T must contain the LUB of U. The types string and number guarantee no keys so the GLB is the empty set, hence why they are filtered out.

1. I should probably get rid of the symbol flag in the filter function.
2. I'm not sure this fix generalises to arbitrary index signatures; maybe we should hold off on this until that is merged.

@jack-williams jack-williams changed the title Fix #28798 Fix #28798: Treat primitive key types as empty when relating to indexer from generic mapped type. Feb 2, 2019
@jack-williams
Copy link
Collaborator Author

Will fix conflicts this week.

@jack-williams
Copy link
Collaborator Author

@ahejlsberg Closing the PR as you have fixed this in #30769

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

String Indexer Assignable to Generic Mapped Type
2 participants