From 9e1a05c9eceec2faf98e23e41a960f024272a32e Mon Sep 17 00:00:00 2001 From: Benjamin Lichtman Date: Fri, 14 Sep 2018 17:20:41 -0700 Subject: [PATCH] Handle function assigned to binding pattern --- src/services/suggestionDiagnostics.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/suggestionDiagnostics.ts b/src/services/suggestionDiagnostics.ts index 77abed76265..291d607cee8 100644 --- a/src/services/suggestionDiagnostics.ts +++ b/src/services/suggestionDiagnostics.ts @@ -132,7 +132,7 @@ namespace ts { // check that a property access expression exists in there and that it is a handler const returnStatements = getReturnStatementsWithPromiseHandlers(node); if (returnStatements.length > 0) { - diags.push(createDiagnosticForNode(isVariableDeclaration(node.parent) && !node.name ? node.parent.name : node, Diagnostics.This_may_be_converted_to_an_async_function)); + diags.push(createDiagnosticForNode(!node.name && isVariableDeclaration(node.parent) && isIdentifier(node.parent.name) ? node.parent.name : node, Diagnostics.This_may_be_converted_to_an_async_function)); } }