Skip to content

Commit 58f6f3d

Browse files
committed
merge helper function
1 parent a593fd0 commit 58f6f3d

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

src/compiler/checker.ts

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27536,30 +27536,23 @@ namespace ts {
2753627536

2753727537
function checkDeprecatedSignature(signature: Signature, node: CallLikeExpression) {
2753827538
if (signature.declaration && signature.declaration.flags & NodeFlags.Deprecated) {
27539-
const suggestionNode = getSignatureSuggestionNode(node);
27539+
const suggestionNode = getDeprecatedSuggestionNode(node);
2754027540
errorOrSuggestion(/*isError*/ false, suggestionNode, Diagnostics._0_is_deprecated, signatureToString(signature));
2754127541
}
2754227542
}
2754327543

27544-
function getSignatureSuggestionNode(node: CallLikeExpression): Node {
27544+
function getDeprecatedSuggestionNode(node: Node): Node {
27545+
node = skipParentheses(node);
2754527546
switch (node.kind) {
2754627547
case SyntaxKind.CallExpression:
2754727548
case SyntaxKind.Decorator:
2754827549
case SyntaxKind.NewExpression:
27549-
return getDeprecatedSuggestionNode(node.expression);
27550+
return getDeprecatedSuggestionNode((<Decorator | CallExpression | NewExpression>node).expression);
2755027551
case SyntaxKind.TaggedTemplateExpression:
27551-
return getDeprecatedSuggestionNode(node.tag);
27552+
return getDeprecatedSuggestionNode((<TaggedTemplateExpression>node).tag);
2755227553
case SyntaxKind.JsxOpeningElement:
2755327554
case SyntaxKind.JsxSelfClosingElement:
27554-
return getDeprecatedSuggestionNode(node.tagName);
27555-
default:
27556-
return Debug.assertNever(node);
27557-
}
27558-
}
27559-
27560-
function getDeprecatedSuggestionNode(node: Node): Node {
27561-
node = skipParentheses(node);
27562-
switch (node.kind) {
27555+
return getDeprecatedSuggestionNode((<JsxOpeningLikeElement>node).tagName);
2756327556
case SyntaxKind.ElementAccessExpression:
2756427557
return (<ElementAccessExpression>node).argumentExpression;
2756527558
case SyntaxKind.PropertyAccessExpression:

0 commit comments

Comments
 (0)