Fix maybeMappedType function#3529
Merged
Merged
Conversation
jakebailey
approved these changes
Apr 23, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes the TypeScript-Go checker’s mapped-type “Did you mean P in K?” suggestion so that TS2690 is reported (with the suggestion) instead of falling back to the generic TS2693, aligning output with the upstream TypeScript baselines and resolving #3509.
Changes:
- Fix
Checker.maybeMappedTypeto walk up from the identifier to the computed property/type literal context before deciding to emit the mapped-type suggestion. - Tighten the key-type check for the suggestion using
allTypesAssignableToKindEx(..., strict=true)soany/unknown/null/undefineddon’t incorrectly qualify. - Update/clean up baselines and triage tracking now that the output matches the submodule expectations.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
internal/checker/checker.go |
Corrects ancestor-walk logic in maybeMappedType and refines the “is union of string/number literals” check to restore mapped-type suggestion diagnostics. |
testdata/submoduleTriaged.txt |
Removes the triage entry for #3509 since it’s no longer a known baseline mismatch. |
testdata/baselines/reference/submoduleTriaged/compiler/typeUsedAsTypeLiteralIndex.errors.txt.diff |
Deletes the triaged diff baseline because the mismatch is resolved. |
testdata/baselines/reference/submodule/compiler/typeUsedAsTypeLiteralIndex.errors.txt |
Updates the reference baseline to reflect the restored TS2690 + suggestion output. |
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.
Fixes #3509.