diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 1314f1ae34d1d..cea6e3c7351c8 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -13307,7 +13307,7 @@ namespace ts { function isUncalledFunctionReference(node: Node, symbol: Symbol) { return !(symbol.flags & (SymbolFlags.Function | SymbolFlags.Method)) || !isCallLikeExpression(findAncestor(node, n => !isAccessExpression(n)) || node.parent) - && every(symbol.declarations, d => !isFunctionLike(d) || !!(d.flags & NodeFlags.Deprecated)); + && every(symbol.declarations, d => !isFunctionLike(d) || !!(getCombinedNodeFlags(d) & NodeFlags.Deprecated)); } function getPropertyTypeForIndexType(originalObjectType: Type, objectType: Type, indexType: Type, fullIndexType: Type, suppressNoImplicitAnyError: boolean, accessNode: ElementAccessExpression | IndexedAccessTypeNode | PropertyName | BindingName | SyntheticExpression | undefined, accessFlags: AccessFlags, reportDeprecated?: boolean) { @@ -22092,7 +22092,7 @@ namespace ts { const localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol); let declaration: Declaration | undefined = localOrExportSymbol.valueDeclaration; - if (declaration?.flags & NodeFlags.Deprecated && isUncalledFunctionReference(node.parent, localOrExportSymbol)) { + if (declaration && getCombinedNodeFlags(declaration) & NodeFlags.Deprecated && isUncalledFunctionReference(node.parent, localOrExportSymbol)) { errorOrSuggestion(/* isError */ false, node, Diagnostics._0_is_deprecated, node.escapedText as string);; } if (localOrExportSymbol.flags & SymbolFlags.Class) { diff --git a/tests/cases/fourslash/jsdocDeprecated_suggestion6.ts b/tests/cases/fourslash/jsdocDeprecated_suggestion6.ts new file mode 100644 index 0000000000000..6418da6e6c101 --- /dev/null +++ b/tests/cases/fourslash/jsdocDeprecated_suggestion6.ts @@ -0,0 +1,46 @@ +// @Filename: a.tsx +//// /** @deprecated */ +//// type Props = {} + +//// /** @deprecated */ +//// const Component = (props: [|Props|]) => props &&
; + +//// <[|Component|] old="old" new="new" /> + +//// /** @deprecated */ +//// type Options = {} + +//// /** @deprecated */ +//// const deprecatedFunction = (options: [|Options|]) => { options } + +//// [|deprecatedFunction|]({}); + +goTo.file('a.tsx') +const ranges = test.ranges(); + +verify.getSuggestionDiagnostics([ + { + message: "'Props' is deprecated", + code: 6385, + range: ranges[0], + reportsDeprecated: true, + }, + { + message: "'Component' is deprecated", + code: 6385, + range: ranges[1], + reportsDeprecated: true + }, + { + message: "'Options' is deprecated", + code: 6385, + range: ranges[2], + reportsDeprecated: true, + }, + { + message: "'deprecatedFunction' is deprecated", + code: 6385, + range: ranges[3], + reportsDeprecated: true, + } +]) \ No newline at end of file