Port TS#62283: Clear SkipGenericFunctions in yield expression checking#2745
Merged
jakebailey merged 2 commits intomainfrom Feb 12, 2026
Merged
Port TS#62283: Clear SkipGenericFunctions in yield expression checking#2745jakebailey merged 2 commits intomainfrom
jakebailey merged 2 commits intomainfrom
Conversation
…or types Clear CheckModeSkipGenericFunctions flag when checking yield expressions in checkAndAggregateYieldOperandTypes, preventing silentNeverType from leaking into inferred generator types based on inner generic calls. Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Port silentNeverType leak fix for generator types
Port TS#62283: Clear SkipGenericFunctions in yield expression checking
Feb 11, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR ports TypeScript#62283, fixing a type inference bug where silentNeverType was leaking into generator return types when yield expressions contained generic function calls. The fix clears the CheckModeSkipGenericFunctions flag when checking yield operands, matching the existing pattern used for return statements and arrow function bodies.
Changes:
- Clear
CheckModeSkipGenericFunctionsincheckAndAggregateYieldOperandTypeswhen checking yield expression operands to preventsilentNeverTypefrom incorrectly propagating into inferred generator types
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| internal/checker/checker.go | Added flag clearing (checkMode & ^CheckModeSkipGenericFunctions) when checking yield expression operands in checkAndAggregateYieldOperandTypes, matching the pattern used for return and arrow expressions |
| testdata/baselines/reference/submodule/compiler/genericCallAtYieldExpressionInGenericCall2.errors.txt | Removed spurious TS2488 error (entire error file now empty) |
| testdata/baselines/reference/submodule/compiler/genericCallAtYieldExpressionInGenericCall2.errors.txt.diff | Reflects removal of spurious TS2488 error |
| testdata/baselines/reference/submodule/compiler/genericCallAtYieldExpressionInGenericCall1.errors.txt | Error count reduced from 7 to 3, removing spurious TS2488 errors from yield expressions |
| testdata/baselines/reference/submodule/compiler/genericCallAtYieldExpressionInGenericCall1.errors.txt.diff | Shows reduction in errors and correction of type inference (Generator instead of Generator) |
| testdata/baselines/reference/submodule/compiler/genericCallAtYieldExpressionInGenericCall1.types | Generator types now correctly infer number instead of any for yield type parameter |
| testdata/baselines/reference/submodule/compiler/genericCallAtYieldExpressionInGenericCall1.types.diff | Shows improved type inference in generator return types |
Member
|
I'll note that this also "ports" microsoft/TypeScript#61317 in that microsoft/TypeScript#62283 effectively reverted the former and used a different fix. |
RyanCavanaugh
approved these changes
Feb 12, 2026
Copilot AI
added a commit
that referenced
this pull request
Feb 25, 2026
#2745) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Copilot AI
added a commit
that referenced
this pull request
Feb 26, 2026
#2745) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Copilot AI
added a commit
that referenced
this pull request
Feb 26, 2026
#2745) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Copilot AI
added a commit
that referenced
this pull request
Feb 26, 2026
#2745) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
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.
Ports microsoft/TypeScript#62283.
silentNeverTypewas leaking into inferred generator types when yield expressions contained inner generic function calls. TheCheckModeSkipGenericFunctionsflag was being passed through tocheckExpressionfor yield operands, causing generic calls to returnsilentNeverTypeinstead of being properly resolved.CheckModeSkipGenericFunctionsfromcheckModeincheckAndAggregateYieldOperandTypeswhen checking yield expressions, matching the existing pattern used for return expressions and arrow body expressionssilentNeverIterationTypesand earlysilentNeverTypereturns) were already absent in the Go portBaseline impact:
genericCallAtYieldExpressionInGenericCall1drops from 7 errors to 3 (removes spuriousTS2488errors), generator types correctly infernumberinstead ofany/never.genericCallAtYieldExpressionInGenericCall2error diff eliminated entirely.✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.