Select "types returned by" vs "types of" from the merged dotted name in relation errors - #4772
Draft
RyanCavanaugh with Copilot wants to merge 2 commits into
Draft
Select "types returned by" vs "types of" from the merged dotted name in relation errors#4772RyanCavanaugh with Copilot wants to merge 2 commits into
RyanCavanaugh with Copilot wants to merge 2 commits into
Conversation
Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix TS2719/TS2322 false positive on generic type
Select "types returned by" vs "types of" from the merged dotted name in relation errors
Jul 28, 2026
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.
The repro in the linked issue produces an identical TS2719 chain under
tscandtsgoexcept for one line, wheretsgopicks the wrong condensed message:(Note: the underlying TS2719 is reported by
tsc5.9 and 6.0.3 on this reduction too, and the originalmaterial-react-tablesample from the issue body is now clean under both compilers.)Root cause
Relater.reportErrorcondenses a chain ofTypes_of_property_0_are_incompatibleand signature-return-type messages into a single dotted-name message, but chose the final message from the incoming message rather than the merged path:Upstream
reportIncompatibleStackkeys off the last character of the assembled path (path[path.length - 1] === ")"). The tsgo version was wrong in both directions:foo+bar(...)collapsed to "The types of", whilebar()+.bazretained "The types returned by".Changes
internal/checker/relater.go: pick the message from the merged dotted name —The_types_returned_by_0_...when it ends in), otherwiseThe_types_of_0_....testdata/tests/cases/compiler/nestedReturnTypeIncompatibleMessage.ts: new test coveringfoo.bar(...),foo.bar.baz(...),foo.bar.baz, andfoo.bar().baz.complexRecursiveCollectionsnow matches the reference implementation, so its accepted.diffand the correspondingtestdata/submoduleAccepted.txtentry are removed.extendsboundary (tsc clean, tsgo fails) #4581