Skip to content

Commit 97e5393

Browse files
author
Benjamin Lichtman
committed
Add comment explaining special casing
1 parent 3ad6a66 commit 97e5393

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/services/codefixes/convertToAsyncFunction.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ namespace ts.codefix {
4444
// get the function declaration - returns a promise
4545
const tokenAtPosition = getTokenAtPosition(sourceFile, position);
4646
let functionToConvert: FunctionLikeDeclaration;
47+
48+
// if the parent of a FunctionLikeDeclaration is a variable declaration, the convertToAsync diagnostic will be reported on the variable name
4749
if (isIdentifier(tokenAtPosition) && isVariableDeclaration(tokenAtPosition.parent) &&
4850
tokenAtPosition.parent.initializer && isFunctionLikeDeclaration(tokenAtPosition.parent.initializer)) {
4951
functionToConvert = tokenAtPosition.parent.initializer;

0 commit comments

Comments
 (0)