Stop adding name of function being fixed and update baseline

This commit is contained in:
Benjamin Lichtman
2018-09-17 16:33:32 -07:00
parent 76b0b2f1e8
commit b2378ca40c
3 changed files with 5 additions and 5 deletions

View File

@@ -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);

View File

@@ -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");

View File

@@ -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");