Skip to content
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

Propagate wildcard types in non-homomorphic mapped types #41622

Merged
merged 4 commits into from
Dec 1, 2020
Merged

Conversation

ahejlsberg
Copy link
Member

Fixes #41613.

Copy link
Member

@weswigham weswigham left a comment

Choose a reason for hiding this comment

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

This is... probably? OK. The change is small and seems to do what we want, so that's good, but the extra circularity error seems to indicate that we're now pulling on the mapped type constraint more eagerly than we did before (since we're erroring during type construction, rather than property access), which is worrying. Hopefully this doesn't regress some unforeseen edge cases.

@ahejlsberg
Copy link
Member Author

@weswigham Yes, we do pull on the constraint more eagerly than before, but we're already similarly eager in the homomorphic case, so not worried about that. And the new additional error actually helps pinpoint where the issue is.

@ahejlsberg ahejlsberg merged commit 4782c74 into master Dec 1, 2020
@ahejlsberg ahejlsberg deleted the fix41613 branch December 1, 2020 21:57
@sandersn
Copy link
Member

sandersn commented Dec 3, 2020

Breaks some code on DT: styled-system:

export type TV<T, K extends keyof T> = T[K] extends Record<infer E, any> ? E : never;

Now gives an error on infer E: Type 'E' does not satisfy the constraint 'string | symbol | number'.

Is this expected? I'll file a bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Milestone Bug PRs that fix a bug with a specific milestone
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Premature resolution of conditional type depending on generic key
4 participants