Fix TS4053 when public method return type uses imported type alias for unexported symbol#2913
Draft
Fix TS4053 when public method return type uses imported type alias for unexported symbol#2913
Conversation
Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
When a type alias like `export type ExportBase = Base` is used through an import, and the original type (Base) is not exported, the node builder and symbol accessibility checker could not find an accessible name for the type. The fix adds type alias resolution to `getSymbolIfSameReference` and `isAccessible` so they recognize that a type alias symbol refers to the same entity as its underlying type's symbol. This allows: 1. `getAliasForSymbolInContainer` to find `ExportBase` as a valid alias for `Base` in the module's exports 2. `isAccessible` in `getAccessibleSymbolChain` to recognize the import of `ExportBase` as providing access to `Base` Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
… resolveTypeAliasSymbol helper Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
…r unexported symbol Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix TS4053 error when using imported type from library
Fix TS4053 when public method return type uses imported type alias for unexported symbol
Feb 26, 2026
Member
|
@copilot This is the wrong fix. See all the failing tests and newly added diffs. |
Reverts the code changes to checker.go and symbolaccessibility.go that caused regressions in multiple submodule tests. Also removes the spurious .diff files that were introduced. The test case declarationEmitTypeAliasCannotBeNamed.ts is kept with baselines that correctly show the TS4053 error, documenting the bug for a future correct fix. Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Copilot stopped work on behalf of
jakebailey due to an error
February 26, 2026 19:27
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.
declarationEmitTypeAliasCannotBeNamed.tsreproducing the TS4053 issue.difffiles for submodule baselinesThe previous fix attempted to resolve type aliases in
getContainersOfSymbolandgetAliasForSymbolInContainer, but this had unintended side effects on how symbols are resolved globally, causing regressions in Bluebird↔Promise resolution, enum member symbols, and import clause symbols. A correct fix will need a more targeted approach.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.