Skip to content

Conversation

@thromel
Copy link

@thromel thromel commented Dec 16, 2025

Fixes #62340

Problem

When using @deprecated on a namespace alias like:

export namespace JSX {
    /** @deprecated */
    export import Bar = example.Bar;
}

Accessing JSX.Bar as a type did not show a deprecation warning, even though the alias itself is marked as deprecated.

Root Cause

In checkTypeReferenceOrImport, the resolvedSymbol is the resolved target of the alias (e.g., example.Bar), not the alias symbol itself. Since the alias (the ImportEqualsDeclaration) was not being checked, its @deprecated JSDoc was ignored.

Fix

Added code to also resolve the entity name without resolving aliases (dontResolveAlias: true) and check if the alias symbol itself is deprecated using isDeprecatedSymbol().

Test

Added tests/cases/fourslash/jsdocDeprecated_namespaceAlias.ts covering:

  1. Direct type alias with @deprecated (already worked)
  2. ImportEqualsDeclaration with @deprecated (the bug being fixed)
  3. ImportEqualsDeclaration aliasing a deprecated type (already worked)

Fixes microsoft#62340

When a namespace re-exports a type using `export import Bar = example.Bar`
with a `@deprecated` JSDoc comment, the deprecation warning was not being
reported when accessing `JSX.Bar` as a type.

The issue was that in `checkTypeReferenceOrImport`, the `resolvedSymbol`
is the resolved target of the alias, not the alias itself. To detect
deprecation on the alias, we now also resolve the entity name without
resolving aliases and check if the alias symbol itself is deprecated.
@github-project-automation github-project-automation bot moved this to Not started in PR Backlog Dec 16, 2025
@typescript-bot typescript-bot added the For Backlog Bug PRs that fix a backlog bug label Dec 16, 2025
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