Skip to content

Commit 7b72875

Browse files
authored
Fix incorrect deprecated mark (microsoft#39611)
* Fix incorrect deprecated mark * improve test
1 parent dd2fc86 commit 7b72875

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

Diff for: src/compiler/checker.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -30908,7 +30908,7 @@ namespace ts {
3090830908
}
3090930909
const symbol = getNodeLinks(node).resolvedSymbol;
3091030910
if (symbol) {
30911-
if (every(symbol.declarations, d => !isTypeDeclaration(d) || !!(d.flags & NodeFlags.Deprecated))) {
30911+
if (some(symbol.declarations, d => isTypeDeclaration(d) && !!(d.flags & NodeFlags.Deprecated))) {
3091230912
const diagLocation = isTypeReferenceNode(node) && isQualifiedName(node.typeName) ? node.typeName.right : node;
3091330913
errorOrSuggestion(/* isError */ false, diagLocation, Diagnostics._0_is_deprecated, symbol.escapedName as string);
3091430914
}

Diff for: tests/cases/fourslash/jsdocDeprecated_suggestion7.ts

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
///<reference path="fourslash.ts" />
2+
3+
//// enum Direction {
4+
//// Left = -1,
5+
//// Right = 1,
6+
//// }
7+
//// type T = Direction.Left
8+
9+
//// /** @deprecated */
10+
//// const x = 1
11+
//// type x = string
12+
//// var y: x = 'hi'
13+
14+
verify.getSuggestionDiagnostics([]);

0 commit comments

Comments
 (0)