Port TypeScript #62722: Widen reverse mapped type properties#2744
Merged
jakebailey merged 2 commits intomainfrom Feb 12, 2026
Merged
Port TypeScript #62722: Widen reverse mapped type properties#2744jakebailey merged 2 commits intomainfrom
jakebailey merged 2 commits intomainfrom
Conversation
Wrap the return value of inferReverseMappedTypeWorker with getWidenedType() to fix reverse mapped type properties being treated as EPC-valid sources. This matches the TypeScript change at: microsoft/TypeScript#62722 Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Port reverse mapped type properties fix
Port TypeScript #62722: Widen reverse mapped type properties
Feb 11, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Ports TypeScript behavior for reverse mapped type inference by widening inferred property types to avoid spurious Excess Property Checking (EPC) errors, and updates/removes baselines accordingly.
Changes:
- Widen the return type of
inferReverseMappedTypeWorkerviagetWidenedType(...). - Update
.typesbaselines for reverse mapped type inference widening scenarios. - Remove now-unneeded
.diffbaselines and clear error baselines that should no longer report EPC errors.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/checker/inference.go | Widen reverse mapped type inference results to avoid propagating literal types into EPC. |
| testdata/baselines/reference/submodule/compiler/reverseMappedTypeInferenceWidening2.types | Updates expected type output for the “widening2” scenario. |
| testdata/baselines/reference/submodule/compiler/reverseMappedTypeInferenceWidening1.types | Updates expected type output for the “widening1” scenario. |
| testdata/baselines/reference/submodule/compiler/reverseMappedTypeInferenceWidening2.types.diff | Removes obsolete baseline diff after output alignment. |
| testdata/baselines/reference/submodule/compiler/reverseMappedTypeInferenceWidening1.types.diff | Removes obsolete baseline diff after output alignment. |
| testdata/baselines/reference/submodule/compiler/reverseMappedTypeInferenceWidening2.errors.txt.diff | Removes obsolete error diff baseline (errors no longer expected). |
| testdata/baselines/reference/submodule/compiler/reverseMappedTypeInferenceWidening1.errors.txt.diff | Removes obsolete error diff baseline (errors no longer expected). |
| testdata/baselines/reference/submodule/compiler/reverseMappedTypeInferenceWidening2.errors.txt | Clears expected errors (now none). |
| testdata/baselines/reference/submodule/compiler/reverseMappedTypeInferenceWidening1.errors.txt | Clears expected errors (now none). |
testdata/baselines/reference/submodule/compiler/reverseMappedTypeInferenceWidening2.types
Show resolved
Hide resolved
testdata/baselines/reference/submodule/compiler/reverseMappedTypeInferenceWidening1.types
Show resolved
Hide resolved
RyanCavanaugh
approved these changes
Feb 12, 2026
Copilot AI
added a commit
that referenced
this pull request
Feb 25, 2026
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.
Reverse mapped type inference was returning unwidened literal types, causing them to be treated as valid sources for Excess Property Checking (EPC). This produced spurious errors like
'default' does not exist in type '{ type: unknown; }'when using reverse mapped types with literal-valued properties.Ported from microsoft/TypeScript#62722.
inferReverseMappedTypeWorkerreturn withgetWidenedType()so inferred property types likefalsewiden toboolean.difffiles and 2 error baselines deleted (Go now matches TS output for these cases)💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.