Skip to content

Port PR #63200: Add symbol name to unsafe import error (TS2883)#2931

Draft
Copilot wants to merge 4 commits intomainfrom
copilot/port-pr-63200
Draft

Port PR #63200: Add symbol name to unsafe import error (TS2883)#2931
Copilot wants to merge 4 commits intomainfrom
copilot/port-pr-63200

Conversation

Copy link
Contributor

Copilot AI commented Feb 27, 2026

  • Add new diagnostic message TS2883 to diagnostics_generated.go
  • Update SymbolTracker interface in nodebuilder/types.go to add symbolName parameter to ReportLikelyUnsafeImportRequiredError
  • Update checker's SymbolTrackerImpl in checker/symboltracker.go to pass through symbolName
  • Update declarations transformer's SymbolTrackerImpl in transformers/declarations/tracker.go to use new diagnostic when symbolName is available
  • Update call site in checker/nodebuilderimpl.go to pass the symbol name with nil guard
  • Build successfully
  • Accept baseline changes
  • Run full test suite - all tests pass
  • Run code review and security checks - no issues

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits February 27, 2026 19:50
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>
// 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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't symbol be nil?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to trigger the thing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't my PR so I was avoiding it, but, so be it.

@copilot investigate

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants