Skip to content

Map over unions when getting iterated element type from contextual type #40592

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

Merged
merged 1 commit into from
Sep 17, 2020

Conversation

andrewbranch
Copy link
Member

Fixes #40587

#40350 makes Iterable<T> | undefined non-iterable, which is correct on its face, but we failed to map over unions when looking at contextual types, so const x: Iterable<1> | undefined = [1] was an error, because we were looking for the iteration types of the union (which has none) rather than looking at iteration types provided by each constituent in the union.

@andrewbranch andrewbranch merged commit 735a67a into microsoft:master Sep 17, 2020
@andrewbranch andrewbranch deleted the bug/40587 branch September 17, 2020 17:42
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
None yet
Development

Successfully merging this pull request may close these issues.

Inference to Iterable<[K, V]> | undefined fails
3 participants