Port PR #63200: Add symbol name to unsafe import error (TS2883)#2931
Draft
Port PR #63200: Add symbol name to unsafe import error (TS2883)#2931
Conversation
Add new diagnostic TS2883 that includes the symbol name in the error message for unsafe import references. Update SymbolTracker interface and implementations to pass through the symbol name parameter. Co-authored-by: gabritto <19519347+gabritto@users.noreply.github.com>
Co-authored-by: gabritto <19519347+gabritto@users.noreply.github.com>
jakebailey
reviewed
Feb 27, 2026
internal/checker/nodebuilderimpl.go
Outdated
| // since declaration files with these kinds of references are liable to fail when published :( | ||
| b.ctx.encounteredError = true | ||
| b.ctx.tracker.ReportLikelyUnsafeImportRequiredError(oldSpecifier) | ||
| b.ctx.tracker.ReportLikelyUnsafeImportRequiredError(oldSpecifier, symbol.Name) |
Member
There was a problem hiding this comment.
You need to trigger the thing.
Member
There was a problem hiding this comment.
This isn't my PR so I was avoiding it, but, so be it.
@copilot investigate
Contributor
Author
There was a problem hiding this comment.
Added a nil guard in c265e6d. While symbol is the function parameter already dereferenced at line 517 (lookupSymbolChain(symbol, ...)), being defensive here is better. If symbol is nil, symbolName defaults to "" which falls through to the old TS2742 diagnostic.
Member
There was a problem hiding this comment.
Huh, this does mean that symbol cannot be nil. It'd have crashed earlier.
Copilot
AI
changed the title
[WIP] Port changes from PR #63200 to main
Port PR #63200: Add symbol name to unsafe import error (TS2883)
Feb 27, 2026
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.
diagnostics_generated.goSymbolTrackerinterface innodebuilder/types.goto addsymbolNameparameter toReportLikelyUnsafeImportRequiredErrorSymbolTrackerImplinchecker/symboltracker.goto pass throughsymbolNameSymbolTrackerImplintransformers/declarations/tracker.goto use new diagnostic when symbolName is availablechecker/nodebuilderimpl.goto pass the symbol name with nil guard✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.