Fix let/const selection for binding patterns

This commit is contained in:
Andrew Branch 2019-04-17 15:25:00 -07:00
parent 06c8506f96
commit 42c9b47add
No known key found for this signature in database
GPG key ID: 22CCA4B120C427D2
3 changed files with 4 additions and 4 deletions

View file

@ -196,8 +196,8 @@ namespace ts.codefix {
allVarNames.push({ identifier: synthName.identifier, symbol });
addNameToFrequencyMap(collidingSymbolMap, ident.text, symbol);
}
// we only care about identifiers that are parameters and declarations (don't care about other uses)
else if (node.parent && (isParameter(node.parent) || isVariableDeclaration(node.parent))) {
// we only care about identifiers that are parameters, declarations, or binding elements (don't care about other uses)
else if (node.parent && (isParameter(node.parent) || isVariableDeclaration(node.parent) || isBindingElement(node.parent))) {
const originalName = node.text;
const collidingSymbols = collidingSymbolMap.get(originalName);

View file

@ -6,6 +6,6 @@ function /*[#|*/f/*|]*/(): Promise<void>{
// ==ASYNC FUNCTION::Convert to async function==
async function f(): Promise<void>{
let [result] = await fetch('https://typescriptlang.org');
const [result] = await fetch('https://typescriptlang.org');
console.log(result);
}

View file

@ -6,6 +6,6 @@ function /*[#|*/f/*|]*/(): Promise<void>{
// ==ASYNC FUNCTION::Convert to async function==
async function f(): Promise<void>{
let { result } = await fetch('https://typescriptlang.org');
const { result } = await fetch('https://typescriptlang.org');
console.log(result);
}