Skip to content

Conversation

@weswigham
Copy link
Member

@weswigham weswigham commented Sep 5, 2017

Our behavior changed with #17404 to disallow doing for..in on unions containing type variables (which we have allowed in the past, despite its lack of extra safety). With this change we allow it once more, by introducing a propagating flag which tracks the presence of a type variable. Technically, only unions and intersections needed to be special-cased (as anywhere else the flag is propagated will be caught by the NonPrimitive assignability check), but I feel the flag is much cleaner than specializing isTypeAssignableToKind.
Fixes #18203.

@typescript-bot
Copy link
Collaborator

Thanks for your contribution. This PR has not been updated in a while and cannot be automatically merged at the time being. For housekeeping purposes we are closing stale PRs. If you'd still like to continue working on this PR, please leave a message and one of the maintainers can reopen it.

@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants