Fix union type error reporting in getIterationTypesOfIterable#2768
Closed
Fix union type error reporting in getIterationTypesOfIterable#2768
Conversation
…error reporting Move union type handling from getIterationTypesOfIterableWorker to getIterationTypesOfIterable to match TypeScript's behavior. This ensures that when any constituent of a union type is not iterable, the error is reported on the full union type (e.g., '[number, number] | undefined') rather than the individual non-iterable constituent (e.g., 'undefined'). Also ensures that when any constituent fails, the entire iteration type resolution fails (matching TypeScript's behavior of returning undefined for the whole union). Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
…nion types Multiple diff files deleted as tsgo output now matches TypeScript exactly: - ES5For-ofTypeCheck7, ES5For-ofTypeCheck9, ES5For-of30 - noImplicitAnyLoopCrash - destructuringArrayBindingPatternAndAssignment4 (types diff removed) Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix error caused by spreading
Fix union type error reporting in getIterationTypesOfIterable
Feb 12, 2026
RegExpIndicesArray
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When checking iterability of union types, errors were reported on individual non-iterable constituents (e.g.,
Type 'undefined') instead of the full union type (e.g.,Type '[number, number] | undefined'), diverging from TypeScript's behavior.Changes
getIterationTypesOfIterableWorkertogetIterationTypesOfIterable— TypeScript handles union iteration types in the outer function, iterating over constituents and failing the entire resolution if any constituent is non-iterable. The Go port was handling unions in the worker, which reported errors per-constituent and combined partial results instead of failing.regExpIndicesArrayDestructuring.tscovering the reported case.ES5For-ofTypeCheck7,ES5For-ofTypeCheck9,ES5For-of30,noImplicitAnyLoopCrash, anddestructuringArrayBindingPatternAndAssignment4now match TypeScript exactly.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
tsplay.dev/home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
RegExpIndicesArraytype will cause error #2767💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.