mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-31 18:10:56 -05:00
fix(54982): "Inline variable" causes failure when variable is used as the initializer of a destructured variable declaration (#54988)
This commit is contained in:
@@ -132,7 +132,7 @@ function getInliningInfo(file: SourceFile, startPosition: number, tryWithReferen
|
||||
|
||||
// If triggered in a variable declaration, make sure it's not in a catch clause or for-loop
|
||||
// and that it has a value.
|
||||
if (isInitializedVariable(parent) && isVariableDeclarationInVariableStatement(parent)) {
|
||||
if (isInitializedVariable(parent) && isVariableDeclarationInVariableStatement(parent) && isIdentifier(parent.name)) {
|
||||
// Don't inline the variable if it has multiple declarations.
|
||||
if (checker.getMergedSymbol(parent.symbol).declarations?.length !== 1) {
|
||||
return { error: getLocaleSpecificMessage(Diagnostics.Variables_with_multiple_declarations_cannot_be_inlined) };
|
||||
|
||||
Reference in New Issue
Block a user