diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 6f3b94e0b40..f4e08f5f270 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -22738,11 +22738,12 @@ namespace ts { } const localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol); - let declaration: Declaration | undefined = localOrExportSymbol.valueDeclaration; - - if (declaration && getCombinedNodeFlags(declaration) & NodeFlags.Deprecated && isUncalledFunctionReference(node.parent, localOrExportSymbol)) { - errorOrSuggestion(/* isError */ false, node, Diagnostics._0_is_deprecated, node.escapedText as string);; + const sourceSymbol = localOrExportSymbol.flags & SymbolFlags.Alias ? resolveAlias(localOrExportSymbol) : localOrExportSymbol; + if (getDeclarationNodeFlagsFromSymbol(sourceSymbol) & NodeFlags.Deprecated && isUncalledFunctionReference(node.parent, sourceSymbol)) { + errorOrSuggestion(/* isError */ false, node, Diagnostics._0_is_deprecated, node.escapedText as string); } + + let declaration: Declaration | undefined = localOrExportSymbol.valueDeclaration; if (localOrExportSymbol.flags & SymbolFlags.Class) { // Due to the emit for class decorators, any reference to the class from inside of the class body // must instead be rewritten to point to a temporary variable to avoid issues with the double-bind diff --git a/tests/cases/fourslash/jsdocDeprecated_suggestion11.ts b/tests/cases/fourslash/jsdocDeprecated_suggestion11.ts new file mode 100644 index 00000000000..dedb9fe0e18 --- /dev/null +++ b/tests/cases/fourslash/jsdocDeprecated_suggestion11.ts @@ -0,0 +1,27 @@ +/// + +// @filename: /foo.ts +/////** @deprecated */ +////export function foo() {} + +// @filename: /test.ts +////import { [|foo|] } from "./foo"; +////[|foo|]; + +goTo.file("/test.ts"); +const [r0, r1] = test.ranges(); + +verify.getSuggestionDiagnostics([ + { + "code": 6385, + "message": "'foo' is deprecated", + "reportsDeprecated": true, + "range": r0 + }, + { + "code": 6385, + "message": "'foo' is deprecated", + "reportsDeprecated": true, + "range": r1 + } +]);