Skip to content

Resolve aliases in resolveEntityName until we find the given meaning#4043

Open
ahejlsberg wants to merge 2 commits into
mainfrom
fix-4038
Open

Resolve aliases in resolveEntityName until we find the given meaning#4043
ahejlsberg wants to merge 2 commits into
mainfrom
fix-4038

Conversation

@ahejlsberg
Copy link
Copy Markdown
Member

Fixes #4038.

Copilot AI review requested due to automatic review settings May 24, 2026 17:53
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes a checker alias-resolution edge case in resolveEntityName that could stop too early along an alias chain and return a symbol without the requested meaning (e.g. type meaning), which surfaced as TS2315 in a CommonJS + JSDoc generics scenario.

Changes:

  • Update Checker.resolveEntityName to repeatedly resolve aliases until a symbol with the requested meaning is found (or alias resolution stops).
  • Add a new compiler test reproducing the CommonJS module.exports + require() + JSDoc generic typedef scenario.
  • Add new reference baselines (.types, .symbols) for the added test.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
internal/checker/checker.go Resolve alias chains in resolveEntityName until the requested meaning is reached, avoiding premature stop at merged symbols.
testdata/tests/cases/compiler/cjsExportGenericTypes.ts New regression test covering the TS2315 scenario with multiple @template tags and CJS export/require.
testdata/baselines/reference/compiler/cjsExportGenericTypes.types Reference .types baseline for the new test.
testdata/baselines/reference/compiler/cjsExportGenericTypes.symbols Reference .symbols baseline for the new test.

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.

TS2315 when using @template more than once in a file

2 participants