diff --git a/src/services/codefixes/convertToAsyncFunction.ts b/src/services/codefixes/convertToAsyncFunction.ts index 5625f5b4a55..a972dff548a 100644 --- a/src/services/codefixes/convertToAsyncFunction.ts +++ b/src/services/codefixes/convertToAsyncFunction.ts @@ -172,7 +172,7 @@ namespace ts.codefix { // if the identifier refers to a function we want to add the new synthesized variable for the declaration (ex. blob in let blob = res(arg)) // Note - the choice of the last call signature is arbitrary - if (lastCallSignature && !synthNamesMap.has(symbolIdString)) { + if (lastCallSignature && !isFunctionLikeDeclaration(node.parent) && !synthNamesMap.has(symbolIdString)) { const firstParameter = firstOrUndefined(lastCallSignature.parameters); const ident = firstParameter && isParameter(firstParameter.valueDeclaration) && tryCast(firstParameter.valueDeclaration.name, isIdentifier) || createOptimisticUniqueName("result"); const synthName = getNewNameIfConflict(ident, collidingSymbolMap); diff --git a/tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_IgnoreArgs4.js b/tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_IgnoreArgs4.js index a03eb467b2f..a8cbdff4451 100644 --- a/tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_IgnoreArgs4.js +++ b/tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_IgnoreArgs4.js @@ -9,8 +9,8 @@ function res(){ // ==ASYNC FUNCTION::Convert to async function== async function f() { - const result_1 = await fetch('https://typescriptlang.org'); - return res(result_1); + const result = await fetch('https://typescriptlang.org'); + return res(result); } function res(){ console.log("done"); diff --git a/tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_IgnoreArgs4.ts b/tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_IgnoreArgs4.ts index a03eb467b2f..a8cbdff4451 100644 --- a/tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_IgnoreArgs4.ts +++ b/tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_IgnoreArgs4.ts @@ -9,8 +9,8 @@ function res(){ // ==ASYNC FUNCTION::Convert to async function== async function f() { - const result_1 = await fetch('https://typescriptlang.org'); - return res(result_1); + const result = await fetch('https://typescriptlang.org'); + return res(result); } function res(){ console.log("done");