diff --git a/src/services/refactors/extractSymbol.ts b/src/services/refactors/extractSymbol.ts index 6490fde5387..6b9d7221579 100644 --- a/src/services/refactors/extractSymbol.ts +++ b/src/services/refactors/extractSymbol.ts @@ -1597,7 +1597,7 @@ namespace ts.refactor.extractSymbol { const functionErrorsPerScope: Diagnostic[][] = []; const constantErrorsPerScope: Diagnostic[][] = []; const visibleDeclarationsInExtractedRange: NamedDeclaration[] = []; - const exposedVariableSymbolSet = new Map(); // Key is symbol ID + const exposedVariableSymbolSet = new Set(); // Key is symbol ID const exposedVariableDeclarations: VariableDeclaration[] = []; let firstExposedNonVariableDeclaration: NamedDeclaration | undefined; @@ -1903,10 +1903,10 @@ namespace ts.refactor.extractSymbol { const decl = find(visibleDeclarationsInExtractedRange, d => d.symbol === sym); if (decl) { if (isVariableDeclaration(decl)) { - const idString = decl.symbol.id!.toString(); - if (!exposedVariableSymbolSet.has(idString)) { + const declSymbol = decl.symbol; + if (!exposedVariableSymbolSet.has(declSymbol)) { exposedVariableDeclarations.push(decl); - exposedVariableSymbolSet.set(idString, true); + exposedVariableSymbolSet.add(declSymbol); } } else {