Skip to content

Commit b2378ca

Browse files
author
Benjamin Lichtman
committed
Stop adding name of function being fixed and update baseline
1 parent 76b0b2f commit b2378ca

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/services/codefixes/convertToAsyncFunction.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ namespace ts.codefix {
172172

173173
// 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))
174174
// Note - the choice of the last call signature is arbitrary
175-
if (lastCallSignature && !synthNamesMap.has(symbolIdString)) {
175+
if (lastCallSignature && !isFunctionLikeDeclaration(node.parent) && !synthNamesMap.has(symbolIdString)) {
176176
const firstParameter = firstOrUndefined(lastCallSignature.parameters);
177177
const ident = firstParameter && isParameter(firstParameter.valueDeclaration) && tryCast(firstParameter.valueDeclaration.name, isIdentifier) || createOptimisticUniqueName("result");
178178
const synthName = getNewNameIfConflict(ident, collidingSymbolMap);

tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_IgnoreArgs4.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ function res(){
99
// ==ASYNC FUNCTION::Convert to async function==
1010

1111
async function f() {
12-
const result_1 = await fetch('https://typescriptlang.org');
13-
return res(result_1);
12+
const result = await fetch('https://typescriptlang.org');
13+
return res(result);
1414
}
1515
function res(){
1616
console.log("done");

tests/baselines/reference/convertToAsyncFunction/convertToAsyncFunction_IgnoreArgs4.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ function res(){
99
// ==ASYNC FUNCTION::Convert to async function==
1010

1111
async function f() {
12-
const result_1 = await fetch('https://typescriptlang.org');
13-
return res(result_1);
12+
const result = await fetch('https://typescriptlang.org');
13+
return res(result);
1414
}
1515
function res(){
1616
console.log("done");

0 commit comments

Comments
 (0)