Skip to content

Support @deprecated marker on namespace aliases (fixes #62340) - #64853

Open
Prasad Navale (prasad2512) wants to merge 2 commits into
microsoft:mainfrom
prasad2512:fix/issue-62340-deprecated-namespace-alias
Open

Prasad Navale (prasad2512) wants to merge 2 commits into
microsoft:mainfrom
prasad2512:fix/issue-62340-deprecated-namespace-alias

Conversation

@prasad2512

Copy link
Copy Markdown

Fixes #62340

Problem

When an alias inside a namespace (such as export import Bar = example.Bar;) is marked with /** @deprecated */, using that type reference (e.g., let y: JSX.Bar;) does not trigger the deprecation suggestion diagnostic (TS6385: 'Bar' is deprecated.). This occurs because checkTypeReferenceOrImport retrieved the resolved symbol via getResolvedSymbolOrNil, which eagerly resolved the alias target and did not check whether intermediate alias symbols or declarations in the namespace were marked as @deprecated.

Fix

  • In checkTypeReferenceOrImport, resolve the entity name of the type reference with dontResolveAlias: true.
  • If the symbol is an alias, use resolveAliasWithDeprecationCheck to trace the alias chain, reporting deprecations if any alias or target declaration in the chain has the @deprecated tag (matching value reference deprecation behavior).
  • Added unit test TestDeprecatedNamespaceAliasInTypeReference in tsc/internal/checker/checker_test.go verifying deprecation suggestions for direct types, namespace aliases, and re-exported deprecated types.

Copilot AI balanced review requested due to automatic review settings October 18, 2026 05:56
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Oct 18, 2026
@typescript-automation typescript-automation Bot added For Backlog Bug PRs that fix a backlog bug labels Oct 18, 2026
@prasad2512
Prasad Navale (prasad2512) force-pushed the fix/issue-62340-deprecated-namespace-alias branch from 62e0e31 to 9deb3be Compare October 18, 2026 05:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Existing deprecation suggestions can be lost, and import-type references still bypass the new alias check.

3 open issues
What changed in this PR

Addresses #62340 by checking namespace aliases for @deprecated when used as type references.

Changes:

  • Adds alias-chain deprecation checks to the compiler.
  • Adds a regression test covering direct types, namespace aliases, and deprecated targets.
File Description
tsc/​internal/​checker/​checker.go Checks alias deprecation during type-reference validation.
tsc/​internal/​checker/​checker_test.go Tests namespace-alias deprecation suggestions.

Review effort: Balanced

Comment thread tsc/internal/checker/checker.go
Comment thread tsc/internal/checker/checker.go Outdated
Comment thread tsc/internal/checker/checker.go Outdated
@prasad2512

Copy link
Copy Markdown
Author

Addressed review suggestions in commit f2ca475:

  • Checked deprecated aliases in import-type qualified references (import('./foo').JSX.Bar).
  • Preserved deprecation checks for symbols with merged type and value declarations.
  • Included re-exported export specifiers in deprecated alias checks.
  • Extended unit tests covering all cases in sc/internal/checker/checker_test.go.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Backlog Bug PRs that fix a backlog bug

Projects

Status: Not started

Development

Successfully merging this pull request may close these issues.

Support @deprecated marker on namespace aliases

2 participants